anydbm bug ?

Gary Richardson garyr at fidalgo.net
Thu Dec 4 11:07:48 EST 2003


According to the Python Library Reference invoking anydbm.open() with flag
value 'n' should always create a new empty database. However, the following
code produces an error. I stumbled upon this while writing some test code.
Opening and closing the file before invoking anydbm.open() was an attempt to
delete the results of a previous test. Does this indicate a bug in anydbm?

import anydbm
filename = r'C:\My Documents\Python\misc\testdb.tmp'
f = open(filename, 'w')
f.close()
file = anydbm.open(filename, 'n')

produces:

PythonWin 2.2.2 (#37, Nov 26 2002, 10:24:37) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (mhammond at skippinet.com.au) - see
'Help/About PythonWin' for further copyright information.
Traceback (most recent call last):
  File
"C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 301, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\My Documents\Python\PicDas_\Script1.py", line 5, in ?
    file = anydbm.open(filename, 'n')
  File "C:\PYTHON22\LIB\anydbm.py", line 83, in open
    raise error, "db type could not be determined"
error: db type could not be determined
>>>







More information about the Python-list mailing list