By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,235 Members | 1,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,235 IT Pros & Developers. It's quick & easy.

Python 2.3.4, Berkeley db 1.85, db file format not recognized

P: n/a
I'm working on a script that will interface with sendmail on my FreeBSD
box. I'm trying to read my access.db file (yes, it's for a quick and dirty
SMTP-after-POP application). I'm trying:

import bsddb
bsddb.hashopen("access.db")

but I get:
bsddb._db.DBInvalidArgError: (22, 'Invalid argument -- access.db: unexpected file type or format')

This suggests to me that my bsddb is too new. I really don't want to
rebuild sendmail with a more current db, as I'm afraid of breaking
sendmail. Any suggestions on how to read this file?

FWIW, "file access.db" returns "access.db: Berkeley DB 1.85 (Hash, version
2, native byte-order)"

Oct 26 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Dan> import bsddb
Dan> bsddb.hashopen("access.db")

Dan> but I get:
Dan> bsddb._db.DBInvalidArgError: (22, 'Invalid argument -- access.db: unexpected file type or format')

Dan> .... Any suggestions on how to read this file?

See if the bsddb185 module is available:

% python
Python 2.5a0 (#94, Oct 8 2005, 06:49:04)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1671)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
impo>>> import bsddb
import bsddb185
dir(bsddb185) ['__doc__', '__file__', '__name__', 'btopen', 'error', 'hashopen', 'open',
'rnopen'] dir(bsddb)

['UserDict', '_DBWithCursor', '__builtins__', '__doc__', '__file__',
'__name__', '__path__', '__version__', '_bsddb', '_checkflag', '_db',
'_iter_mixin', '_openDBEnv', 'btopen', 'db', 'error', 'hashopen', 'os',
'ref', 'rnopen', 'sys']

If the old libdb.a stuff is available, the bsddb185 module should have been
built automagically.

Skip

Oct 26 '05 #2

P: n/a
On Wed, 26 Oct 2005 14:23:49 -0500, skip wrote:

Dan> import bsddb
Dan> bsddb.hashopen("access.db")

Dan> but I get:
Dan> bsddb._db.DBInvalidArgError: (22, 'Invalid argument -- access.db: unexpected file type or format')

Dan> .... Any suggestions on how to read this file?

See if the bsddb185 module is available:


It is, and it works. Thanks so much!

Oct 26 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.