[Spambayes] *nix error after upgrade
Skip Montanaro
skip at pobox.com
Mon Nov 24 09:58:48 EST 2003
atom> File "/usr/local/lib/python2.3/site-packages/spambayes/hammie.py", line 247, in store
atom> self.bayes.store()
atom> AttributeError: 'NoneType' object has no attribute 'store'
and
atom> File "/usr/local/lib/python2.3/site-packages/spambayes/hammie.py", line 38, in _scoremsg
atom> return self.bayes.spamprob(tokenize(msg), evidence)
atom> AttributeError: 'NoneType' object has no attribute 'spamprob'
Both suggest that opening a database file failed. Somewhere you have a
database file, right? Suppose it's named hammie.db. Try this:
% python
Python 2.4a0 (#5, Nov 23 2003, 20:09:38)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shelve
>>> db = shelve.open("hammie.db")
>>> len(db)
40569
>>> db.close()
Does that succeed for Python 2.2 but fail for 2.3? If so, I'd suspect a
file version change. If not, continue on to step two.
% python
Python 2.4a0 (#5, Nov 23 2003, 20:09:38)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from spambayes.storage import open_storage
>>> s = open_storage("hammie.db")
>>> s
<spambayes.storage.DBDictClassifier instance at 0x764968>
>>> dir(s)
['WordInfoClass', '__doc__', '__getstate__', '__init__', '__module__', '__setstate__', '_add_msg', '_getclues', '_post_training', '_remove_msg', '_wordinfodel', '_wordinfoget', '_wordinfokeys', '_wordinfoset', '_write_state_key', 'changed_words', 'chi2_spamprob', 'close', 'db', 'db_name', 'dbm', 'learn', 'load', 'mode', 'nham', 'nspam', 'probability', 'probcache', 'spamprob', 'statekey', 'store', 'unlearn', 'wordinfo']
>>> s._wordinfoget("python")
WordInfo(2, 14)
Does this succeed for one version of Python but not the other?
I suspect you have some sort of version-related problems, but they are
related to the FreeBSD environment, not directly to Python's versioning.
Skip
More information about the Spambayes
mailing list