[Spambayes] Using sb_upload.py

Graham Ashton graham at effectif.com
Thu Sep 16 08:51:25 CEST 2004

On Wed, 2004-09-15 at 07:50, Tony Meyer wrote:
> > What is sb_upload.py really for?
> It is for exactly what you've described - putting the message into the
> unknown cache.  Then you can use the web interface to train it, manually.
> If you want a script to train a message, then I think sb_[bn]filter can do
> this, and maybe sb_mboxtrain?

Thanks for the reply. Good to know.

I had tried sb_mboxtrain and sb_filter, but (because I'm already running
sb_server as a POP proxy) I get "resource temporarily unavailable" (i.e.
the DBM file is locked).

Traceback (most recent call last):
  File "/usr/local/bin/sb_mboxtrain.py", line 315, in ?
  File "/usr/local/bin/sb_mboxtrain.py", line 296, in main
    h = hammie.open(pck, usedb, "c")
  File "/usr/lib/python2.3/site-packages/spambayes/hammie.py", line 258,
in open    return Hammie(storage.open_storage(filename, useDB, mode))
  File "/usr/lib/python2.3/site-packages/spambayes/storage.py", line
675, in open_storage
    return klass(data_source_name, mode)
  File "/usr/lib/python2.3/site-packages/spambayes/storage.py", line
162, in __init__
  File "/usr/lib/python2.3/site-packages/spambayes/storage.py", line
187, in load
    self.dbm = dbmstorage.open(self.db_name, self.mode)
  File "/usr/lib/python2.3/site-packages/spambayes/dbmstorage.py", line
60, in open
    return f(db_name, mode)
  File "/usr/lib/python2.3/site-packages/spambayes/dbmstorage.py", line
25, in open_gdbm
    return gdbm.open(*args)
gdbm.error: (11, 'Resource temporarily unavailable')

When I stopped sb_server and ran sb_mboxtrain again I got a seperate
traceback (you may choose to ignore this as I'm still using 1.0a7):

ratchet% sb_mboxtrain.py -d hammie.db
Traceback (most recent call last):
  File "/usr/local/bin/sb_mboxtrain.py", line 315, in ?
  File "/usr/local/bin/sb_mboxtrain.py", line 310, in main
    if save:
UnboundLocalError: local variable 'save' referenced before assignment

Once I'd shut down sb_server I found that running sb_filter with the -g
option did the job.

The problem is, I don't want to have to kill the proxy in order to train
from my drag-n-drop application. If I were to develop a means for
sb_server users to train from the command line and provide a patch,
which approach would you prefer? I was wondering if a patch providing -s
and -g for sb_upload would be the right thing.

At the moment I'm considering web page scraping/CGI POST from within my
application, but I suppose an sb_upload patch would be more in the
spirit of open source...

Graham Ashton <graham at effectif.com>

More information about the Spambayes mailing list