[Spambayes] Moving the db from a pc to a server
Skip Montanaro
skip at pobox.com
Thu Jun 19 21:09:04 EDT 2003
Hadar> $ python dbExpImp.py -e -d /c/Documents\ and\ Settings/hadar/Application\ Data/
Hadar> SpamBayes/default_bayes_database.db -f export.txt
Hadar> Traceback (most recent call last):
Hadar> File "dbExpImp.py", line 262, in ?
Hadar> runExport(dbFN, useDBM, flatFN)
Hadar> File "dbExpImp.py", line 112, in runExport
Hadar> bayes = spambayes.storage.PickledClassifier(dbFN)
Hadar> File "C:\cygwin\home\hadar\SpamBayesSource\spambayes\spambayes\storage.py", li
Hadar> ne 80, in __init__
Hadar> self.load()
Hadar> File "C:\cygwin\home\hadar\SpamBayesSource\spambayes\spambayes\storage.py", li
Hadar> ne 103, in load
Hadar> tempbayes = pickle.load(fp)
Hadar> cPickle.UnpicklingError: invalid load key, ' '.
This looks like you're trying to read the database file as a pickle. I've
never used dbExpImp.py myself, so I'm not sure I can help you with that.
You might try the db2pickle.py and pickle2db.py scripts. They are in the
Tools/scripts directory of the Python distribution. I can send them to you
if you don't have them or you can pull them from the CVS browser on
SourceForge:
http://tinyurl.com/d2a3
You would run db2pickle.py on your PC using the version of Python embedded
in SpamAtBay, transfer the pickle file to your server, then run pickle2db.py
there to generate a db file usable by hammie.
Hadar> Here's an example of a failed "open" call:
>>>> d=anydbm.open("default_bayes_database.db", "r")
Hadar> Traceback (most recent call last):
Hadar> File "<stdin>", line 1, in ?
Hadar> File "/usr/lib/python2.2/anydbm.py", line 86, in open
Hadar> return mod.open(file, flag, mode)
Hadar> File "/usr/lib/python2.2/dbhash.py", line 16, in open
Hadar> return bsddb.hashopen(file, flag, mode)
Hadar> bsddb.error: (22, 'Invalid argument')
This error isn't all that surprising. I suspect your Unix server and your
Windows machine use different versions of the Berkeley DB library, so you
probably won't be able to simply transfer the db file directly.
Skip
More information about the Spambayes
mailing list