[spambayes-dev] Dibbler.py error in training

Kenny Pitt kennypitt at hotmail.com
Fri Apr 2 13:35:35 EST 2004

Skip Montanaro wrote:
>     sean> So, I used CVS today. Now I get:
>     ...
>     sean>   File
"/usr/lib/python2.3/site-packages/spambayes/storage.py", line 606, in
>     sean> onRemoveMessage
>     sean>     if flags.find(NO_TRAINING_FLAG) < 0: 
>     sean> AttributeError: 'NoneType' object has no attribute 'find'
> This looks like a bug in onRemoveMessage().  I don't know what the
> meaning of a flags value of None is supposed to be so I can't fix it,
> but it's clear that the flags.find() call has to be conditional on
> flags not being None.  Tony added that code in the past week or so.
> I trust he will know the correct fix.

I just checked in a fix for this.  flags=None was supposed to represent
that no flags had been passed.  I changed the code to use integer bit
values that could be OR'd together if we ever add more flags in the
future, and it now defaults to flags=0 for no flags.

This error only seems to occur if you retrain a message that was trained
into the wrong corpus (either correcting a training mistake, or
retraining a false positive or false negative with a train-on-everything
strategy).  onRemoveMessage is not called on the unknown corpus.

Kenny Pitt

More information about the spambayes-dev mailing list