Shelve problem in 1.5.2

Nick Belshaw nickb at earth.ox.ac.uk
Fri Oct 29 06:22:03 EDT 1999


I have searched through old messages on python.org and couldn't find an
answer to this so if anyone can help......
I have just upgraded from 1.5.1 to 1.5.2 on a Linux/RedHat(now 6.1)
system and my shelve module is behaving strangely. It fails to open old
files and if I open and close a new file it is happy but as soon as I
try to open the newly created file it fails also...
--------------------------------------------
>>> import shelve
>>> q = shelve.open('floop)
>>> q['q']='help'
>>> q.close()
>>> z = shelve.open('floop)
Traceback (innermost last):
 File "<stdin>", line 1, in ?
 File "/usr/lib/python1.5/shelve.py", line 152, in open
 return DbfilenameShelf(filename, flag)
 File "/usr/lib/python1.5/shelve.py", line 142, in __init__
 Shelf.__init__(self, anydbm.open(filename, flag))
 File "/usr/lib/python1.5/anydbm.py", line 85, in open
 raise error, "db type could not be determined"
anydbm.error: db type could not be determined
--------------------------------------
Looking at the source it seems that whichdb.py is returning a null
string which implies that shelve is not writing a magic number to the
file on closing.
Thats as far as I got - I suppose I am missing something obvious so if
someone could help I would be very grateful.
cheers
Nick/Oxford


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /