Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\WINDOWS>python Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] o win32 Type "help", "copyright", "credits" or "license" for more information. >>> import shelve >>> d = shelve.open("foo") >>> d["foo"] = u"bar" >>> d["foo"] u'bar' >>> d[u"bar"] = "foo" Traceback (most recent call last): File "", line 1, in File "C:\Python25\lib\shelve.py", line 124, in __setitem__ self.dict[key] = f.getvalue() File "C:\Python25\lib\bsddb\__init__.py", line 230, in __setitem__ _DeadlockWrap(wrapF) # self.db[key] = value File "C:\Python25\lib\bsddb\dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) File "C:\Python25\lib\bsddb\__init__.py", line 229, in wrapF self.db[key] = value TypeError: String or Integer object expected for key, unicode found >>> import bsddb >>> db = bsddb.btopen('foobar', 'c') >>> db["foo"] = u"bar" >>> db[u"bar"] = "foo" Traceback (most recent call last): File "", line 1, in File "C:\Python25\lib\bsddb\__init__.py", line 230, in __setitem__ _DeadlockWrap(wrapF) # self.db[key] = value File "C:\Python25\lib\bsddb\dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) File "C:\Python25\lib\bsddb\__init__.py", line 229, in wrapF self.db[key] = value TypeError: String or Integer object expected for key, unicode found >>> bsddb.btopen('foobar', 'c')[u'foo'] = "bar" Traceback (most recent call last): File "", line 1, in File "C:\Python25\lib\bsddb\__init__.py", line 230, in __setitem__ _DeadlockWrap(wrapF) # self.db[key] = value File "C:\Python25\lib\bsddb\dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) File "C:\Python25\lib\bsddb\__init__.py", line 229, in wrapF self.db[key] = value TypeError: String or Integer object expected for key, unicode found >>>