Shelve Problem
David
dlashar at sprynet.com
Tue Nov 5 17:17:26 EST 2002
Hello. I am getting some behavior with shelves that I can't figure out. As
shown below, I have a data file that yields an error when the keys() method
is initially invoked. If, however, I invoke the keys() method after
checking for the existence of the expected key (w/ the has_key() method),
the keys() method "suddenly" works. Any insights/suggestions would be
appreciated. Thanks,
David
>>> sh = shelve.open('c:\\jdl_files\\sport.data')
>>> sh.keys()
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "shelve.py", line 56, in keys
return self.dict.keys()
error: (22, 'Invalid argument')
>>> sh.dict.has_key('baseball')
1
>>> sh.keys()
['baseball']
>>> sh.close()
More information about the Python-list
mailing list