[Spambayes] Another Error on review page
David Shaw
david at theresistance.net
Sat Feb 8 10:52:37 EST 2003
For those of us who do not have checkin capability (or need it), how do
we submit patches? I fixed the problem below in my version by checking
that the self.nspam and self.nham values are integers, and if not,
convert them.
cvs diff spambayes/classifier.py
Index: spambayes/classifier.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/classifier.py,v
retrieving revision 1.3
diff -r1.3 classifier.py
33a34
> import types
387c388,391
< self.nspam += 1
---
> if type(self.nspam) == types.IntType:
> self.nspam += 1
> else:
> self.nspam = int(self.nspam) + 1
389c393,396
< self.nham += 1
---
> if type(self.nham) == types.IntType:
> self.nham += 1
> else:
> self.nham = int(self.nham) + 1
On Friday, February 7, 2003, at 10:54 PM, David Shaw wrote:
> When trying to classify a message, I got the following error. Is
> there any way to run the pop proxy interactively so you can "poke" it
> to see what data lives at self.nham that is causing the problem? I
> use ZEO to do this in Zope and it's very helpful.
>
> Traceback (most recent call last):
>
> File "spambayes/Dibbler.py", line 398, in found_terminator
> getattr(plugin, name)(**params)
>
> File "./pop3proxy.py", line 865, in onReview
> targetCorpus.takeMessage(id, state.unknownCorpus)
>
> File "spambayes/Corpus.py", line 201, in takeMessage
> self.addMessage(msg)
>
> File "spambayes/FileCorpus.py", line 143, in addMessage
> Corpus.Corpus.addMessage(self, message)
>
> File "spambayes/Corpus.py", line 136, in addMessage
> obs.onAddMessage(message)
>
> File "spambayes/storage.py", line 219, in onAddMessage
> self.train(message)
>
> File "spambayes/storage.py", line 227, in train
> self.bayes.learn(message.tokenize(), self.is_spam)
>
> File "spambayes/classifier.py", line 270, in learn
> self._add_msg(wordstream, is_spam)
>
> File "spambayes/classifier.py", line 389, in _add_msg
> self.nham += 1
>
> TypeError: cannot concatenate 'str' and 'int' objects
>
> On a related note, I wonder if there would be benefit in storing in
> ZODB rather than straight DBM/pickles (ZODB can use bsddb3 or pickles
> as well).
> _______________________________________________
> Spambayes mailing list
> Spambayes at python.org
> http://mail.python.org/mailman/listinfo/spambayes
>
More information about the Spambayes
mailing list