WIN32 DBM help needed

John Blacker jcblacker at mindspring.com
Wed Aug 2 16:11:55 EDT 2000


I'm trying to work my way through various examples in Mark Lutz's book
"Programming Python" and have hit a snag with dbm.  Specifically, if I
simply import anybdm and then open a file, no problem.  However, if I run
session1.py, session2.py or session3.py which open an existing, supplied
"shelve", I get the following:

<person.Person instance at 7fbca0>
('bob', 'psychologist', 70000, 17500.0)
(35, 40) 10000.0
('howard', '', 0, 0.0)
Traceback (innermost last):
  File "session1.py", line 20, in ?
    dbase = shelve.open('cast')          # make a shelve (dbm) file called
'cast'
  File "D:\Program Files\Python\Lib\shelve.py", line 152, in open
    return DbfilenameShelf(filename, flag)
  File "D:\Program Files\Python\Lib\shelve.py", line 142, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag))
  File "D:\Program Files\Python\Lib\anydbm.py", line 85, in open
    mod = __import__(result)
ImportError: No module named dbm

So, thinking that I don't have any dbm (or gdbm) support, I downloaded a lib
called
win32_gdbm.zip which I retrieved from www.roth.net , unzipped it and copied
it to my Python "libs" directory.  Then I retrieved a port of the GDBM 1.7.3
Python support module and put it's gdbm.pyd file in the Python\DLLs
directory.  The examples still don't work, nor does the "formtbl.py"
example.  I can perform an "import gdbm" but not "import dbm", thus the
examples
fail.  Can someone help me untangle this mess?





More information about the Python-list mailing list