opening anydbm files

Fredrik Lundh fredrik at pythonware.com
Thu Nov 4 03:31:46 EST 1999


Scott Barron wrote:
> According to the docs and Fredrik's book this should work but I get the
> following:
> 
> Python 1.5.2 (#8, Oct 13 1999, 22:39:47)  [GCC 2.7.2.3] on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> db = anydbm.open ("foo", "r")
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python1.5/anydbm.py", line 80, in open
>     raise error, "need 'c' or 'n' flag to open new db"
> anydbm.error: need 'c' or 'n' flag to open new db

you get this error if whichdb fails to identify the
existing database -- the most likely reason is that
anydbm("c") used the "dumbdbm" handler.

try running:

    import anydbm
    print anydbm._defaultmod

to see what the default database handler is.

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list