[Spambayes] Moving the db from a pc to a server

Hadar Pedhazur hadar at unorthodox.com
Thu Jun 19 21:20:53 EDT 2003


Hi all. A few weeks ago, I raised the question about moving
a database over from a pc (using the Outlook plugin) to a
server running RH8, so that hammiefilter.py could be used on
the server to filter for my Blackberry, using the set
trained from my pc. Mark responded that to his knowledge, no
one had tried it yet, and that I should report back if/when
I did.

So, tonight, I finally found some time to try this. In the
meantime, I have switched to the SpamAtBay product (in case
that makes a difference to what I am about to report). I am
running Beta 10 of SAB.

I have a file in the default location called:

default_bayes_database.db

Size is 8,396,800

Before worrying about whether the file would just copy over
from the pc to the server, I figured I'd use the dbExpImp.py
script. When I ran it on the pc, I got the following
exception:

$ python dbExpImp.py -e -d /c/Documents\ and\ Settings/hadar/Application\ Data/
SpamBayes/default_bayes_database.db -f export.txt
Traceback (most recent call last):
  File "dbExpImp.py", line 262, in ?
    runExport(dbFN, useDBM, flatFN)
  File "dbExpImp.py", line 112, in runExport
    bayes = spambayes.storage.PickledClassifier(dbFN)
  File "C:\cygwin\home\hadar\SpamBayesSource\spambayes\spambayes\storage.py", li
ne 80, in __init__
    self.load()
  File "C:\cygwin\home\hadar\SpamBayesSource\spambayes\spambayes\storage.py", li
ne 103, in load
    tempbayes = pickle.load(fp)
cPickle.UnpicklingError: invalid load key, ' '.

Long story short, while "whichdb.whichdb" report that this
file is a dbhash, any call to "open" on that file, whether
through anydbm, or bsddb, etc., returns an error. On the
other hand, the file continues to work correctly under the
SAB program.

Here's an example of a failed "open" call:

>>> d=anydbm.open("default_bayes_database.db", "r")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/anydbm.py", line 86, in open
    return mod.open(file, flag, mode)
  File "/usr/lib/python2.2/dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
bsddb.error: (22, 'Invalid argument')

So, having finally found the time to work on this, I'm stuck
right at the beginning of the journey.

If someone can tell me what's going on here, I'm happy to
continue hooking up the db to hammiefilter through procmail,
and see what happens.

Thanks in advance!



More information about the Spambayes mailing list