J
josegomez
Hi!
I want to use shelve to store lists which are indexed by an integer
key. The keys are not concurrent or anything, they are just defined as
integer values. However, shelve complains that I cannot have integer
keys. Here's the error:
File "<input>", line 1, in ?
File "E:\Python23\lib\shelve.py", line 118, in __getitem__
f = StringIO(self.dict[key])
File "E:\Python23\lib\bsddb\__init__.py", line 116, in __getitem__
return self.db[key]
TypeError: Integer keys only allowed for Recno and Queue DB's
I understand that Recno is part of the bsddb3, but I don't know how to
instruct shelve to use the Recno back-end.
The other option is to str() the integer key, but I'd rather use an
integer key, and avoid all the extra clutter.
Did I miss something?
Ta
Jose
I want to use shelve to store lists which are indexed by an integer
key. The keys are not concurrent or anything, they are just defined as
integer values. However, shelve complains that I cannot have integer
keys. Here's the error:
Traceback (most recent call last):
File "<input>", line 1, in ?
File "E:\Python23\lib\shelve.py", line 118, in __getitem__
f = StringIO(self.dict[key])
File "E:\Python23\lib\bsddb\__init__.py", line 116, in __getitem__
return self.db[key]
TypeError: Integer keys only allowed for Recno and Queue DB's
I understand that Recno is part of the bsddb3, but I don't know how to
instruct shelve to use the Recno back-end.
The other option is to str() the integer key, but I'd rather use an
integer key, and avoid all the extra clutter.
Did I miss something?
Ta
Jose