[Spambayes] KeyError in sp_imapfilter

Tony Meyer tameyer at ihug.co.nz
Wed Dec 15 23:47:27 CET 2004


> The version I was using was the version that I checked out of CVS two
> days ago.  I am not sure why the version number it is giving is older
> than the 1.0.1 release. 

Ah, I didn't realise you were using the CVS version.  That version of
sb_imapfilter (which will be 1.1) has changed considerably since the 1.0
release.  One of the things that will be addressed with the 1.1 release is
the version information (it's messy and complicated now and needs to be
simplified).  However, this hasn't been done yet, so the version information
is all as it was before the 1.0 branch was forked.  If you do 'python -c
"import spambayes;print spambayes.__version__"', you'll get "1.1a0", but the
stuff the applications report will be quite out of date.

> I downloaded the 1.0.1 release and tried
> installing it (python setup.py install) but I got a different 
> error when trying to run sb_imapfilter.py:
> 
> SpamBayes IMAP Filter Version 0.5 (November 2004)
> and engine SpamBayes Engine Version 0.3 (January 2004).
> 
> Traceback (most recent call last):
>   File "/usr/bin/sb_imapfilter.py", line 924, in ?
>     run()
>   File "/usr/bin/sb_imapfilter.py", line 910, in run
>     imap_filter.Train()
>   File "/usr/bin/sb_imapfilter.py", line 743, in Train
>     num_ham_trained = folder.Train(self.classifier, False)
>   File "/usr/bin/sb_imapfilter.py", line 678, in Train
>     classifier.learn(msg.asTokens(), isSpam)
> AttributeError: IMAPMessage instance has no attribute 'asTokens'

You're probably better off sticking with the CVS version - it really is much
improved from the 1.0.x one.  This error has something to do with the two
versions - most likely using the 1.0.1 sb_imapfilter.py script with the CVS
spambayes package (CVS doesn't have the asTokens() function, but 1.0.1
does).  Either it's picking up the old version of the package from
somewhere, or setup.py install didn't run properly - since the version
details changed, I presume it was the latter, but it's hard to tell.

To fix this, and use 1.0.1, the best move would be to remove the
Lib/site-packages/spambayes directory, and Scripts/sb_*.py, ensure that
there are no other spambayes scripts anywhere, and then redo setup.py
install with the 1.0.1 release.

> I have attached the run with the 1.0.1 release using -i4.

Unfortunately, this isn't relevant to the problem that there was with CVS
(we'd need the trace from a run with that).

=Tony.Meyer

-- 
Please always include the list (spambayes at python.org) in your replies
(reply-all), and please don't send me personal mail about SpamBayes.
http://www.massey.ac.nz/~tameyer/writing/reply_all.html explains this.



More information about the Spambayes mailing list