Serious problem with Shelve

Rami A. Kishek ramiak2000 at yahoo.com
Tue Aug 19 02:34:05 EDT 2003


Actually, I take my last message back - it is not so simple.  After
surfing the anydbm.py and whichdb.py, I ended up commenting out lines
97/98 of the latter:

#    if magic in (0x00061561, 0x61150600):
#        return "bsddb185"

since I know that I did not install the old bsddb185 with the Python
2.3, and am supposed to have new BSD libraries.  Instead, shelve gave me
this error when I tried creating new files and reopening them. 
Something is very funny here and I really hope the python 2.3 developers
would pay attention here.  If 2.3 was shipped with the bsddb 1.85
disabled, then why is it complaining about the db (created with 2.3)
being a bsddb185?

  File "D:\PROGRAMS\PYTHON23\lib\shelve.py", line 231, in open
    return DbfilenameShelf(filename, flag, protocol, writeback, binary)
  File "D:\PROGRAMS\PYTHON23\lib\shelve.py", line 212, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol,
writeback, binary)
  File "D:\PROGRAMS\PYTHON23\lib\anydbm.py", line 80, in open
    raise error, "db type could not be determined"
error: db type could not be determined

Incidentally, on the other machine I mentioned (the one on which shelve
worked perfectly with 2.2.3) shelve still works perfectly after
upgrading to 2.3.  Since that is a Linux 2 machine, I figure perhaps it
is using a different db like gdbm or something ... 


"Rami A. Kishek" wrote:
> 
> Well - I installed Python 2.3, but it still doesn't.  My program now
> crashes on the first pass.  After deleting the old databases and
> creating new ones, I opened them for read and this is what I get:
> 
>     self.revs = shelve.open(os.path.join(tgtdir, dbfn))
>   File "D:\PROGRAMS\PYTHON23\lib\shelve.py", line 231, in open
>     return DbfilenameShelf(filename, flag, protocol, writeback, binary)
>   File "D:\PROGRAMS\PYTHON23\lib\shelve.py", line 212, in __init__
>     Shelf.__init__(self, anydbm.open(filename, flag), protocol,
> writeback, binary)
>   File "D:\PROGRAMS\PYTHON23\lib\anydbm.py", line 82, in open
>     mod = __import__(result)
> ImportError: No module named bsddb185
> 
> I will try enclosing that import bsddb185 in anydbm.py in try: except:,
> though I hate messing around with source files, and there may be many
> more such problems.  Python developers, be aware of this glitch.
>




More information about the Python-list mailing list