problems importing "bsddb"

Andrew MacIntyre andymac at
Thu Aug 14 01:42:47 CEST 2003

On Tue, 12 Aug 2003, Skip Montanaro wrote:

>     John> We are using OpenBSD latest release of Python (2.3),  and want to
>     John> use the "bsddb" module.   Our python release has a directory
>     John> called "bsddb",  but when we try and import it,   it says
>     >>> import bsddb
>      Traceback (most recent call last):
>        File "<stdin>", line 1, in ?
>        File "/usr/local/lib/python2.3/bsddb/", line 40, in ?
>          import _bsddb
>      ImportError: No module named _bsddb
> You need to install version 3 or 4 of Berkeley DB.  It may be available as
> part of OpenBSD or as a port, but you can get the source from
> and install it from source easily.  Once you've done that, rerun
>     python install
> in the Python source tree.

I'm sure that OpenBSD also has BSD DB v1.85 in its libc.  If you are
wanting to access system DB files (terminal capabilities, master password
etc), then you will need to use this instead of Sleepycat's DB3/4 - it
should be available as the bsddb185 module.  If your code is compatible
with the old bsddb module, you could do this as

    import bsddb185 as bsddb

Before Skip goes up in flames, only use the bsddb185 module if you have

Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at  (pref) | Snail: PO Box 370
        andymac at             (alt) |        Belconnen  ACT  2616
Web:               |        Australia

More information about the Python-list mailing list