opening anydbm files

Fredrik Lundh fredrik at
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] on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> db = ("foo", "r")
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python1.5/", 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.


<!-- (the eff-bot guide to) the standard python library:

More information about the Python-list mailing list