bsddb.hashopen problem [was: Re: [Pythonmac-SIG] New MacPython-OSX
2.3a1 binary]
Robin Dunn
robin@alldunn.com
Fri, 31 Jan 2003 09:25:59 -0800
Francois Granger wrote:
[...]
>
> I tried to run the script wich gave me this problem, pop3proxy.py from
> the spambayes project. Error below. I retested with a smaller script.
> the line:
>
> dbm = bsddb.hashopen('/Volumes/OS99/spambayesdev/hammie.db', 'r')
>
> give the same error. I don't know who is concerned with this.
>
> [fbg:/Volumes/OS99/spambayesdev] fgranger% which python
> /usr/local/bin/python
> [fbg:/Volumes/OS99/spambayesdev] fgranger% python -v pop3proxy.py
>
> [...]
> import bsddb # directory
> /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bsddb
> #
> /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bsddb/__init__.pyc
> matches
> /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bsddb/__init__.py
>
> import bsddb # precompiled from
> /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bsddb/__init__.pyc
>
> import _bsddb # dynamically loaded from
> /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload/_bsddb.so
>
> Traceback (most recent call last):
> File "pop3proxy.py", line 1557, in ?
> run()
> File "pop3proxy.py", line 1531, in run
> state.createWorkers()
> File "pop3proxy.py", line 1145, in createWorkers
> self.bayes = storage.DBDictClassifier( \
> File "/Volumes/OS99/spambayesdev/spambayes/storage.py", line 140, in
> __init__
> self.load()
> File "/Volumes/OS99/spambayesdev/spambayes/storage.py", line 148, in load
> self.dbm = dbmstorage.open(self.db_name, self.mode)
> File "/Volumes/OS99/spambayesdev/spambayes/dbmstorage.py", line 54, in
> open
> return f(*args)
> File "/Volumes/OS99/spambayesdev/spambayes/dbmstorage.py", line 17, in
> open_dbhash
> return bsddb.hashopen(*args)
> File
> "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bsddb/__init__.py",
> line 162, in hashopen
> d.open(file, _db.DB_HASH, flags, mode)
> bsddb._db.DBInvalidArgError: (22, 'Invalid argument -- memp_fopen: page
> sizes must be a power-of-2')
> [...]
>
Sounds like either spambayes is passing a bad value for the pgsize
parameter, or bsddb.hashopen should have an explicit default value for
pgsize...
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!