Shelve-problems

John Lloyd jrl at clark.net
Sat Oct 16 16:32:00 EDT 1999


Thomas Weholt wrote:

> Hi,
>
> I try to do something like :
>
> >>>import shelve
> >>>db = shelve.open('2')
> >>> db['1'] = 'test'
>
> And quit python, restart it and this happens when I try to read the data
> back in :
>
> >>> import shelve
> >>> db = shelve.open('2')
> 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 83, in open
>     raise error, "db type could not be determined"
> anydbm.error: db type could not be determined
> >>>
>
> Why?!
>
> I am using Linux Suse 6.2. Could I ( my Linux distro.) be missing
> something??
>
> Thomas Weholt

The Suse 6.2 distro does not have dbm built in.  Recompile Python but first
edit the Modules/Setup file to allow gdbm to be compiled in as a shared
library.  Shelve will work but I have not been able to build Tkinter
correctly this way.  So I use /usr/bin/python for Tkinter apps and
/usr/local/bin/python for shelve apps.

John Lloyd







More information about the Python-list mailing list