[Spambayes] big imapfilter.py problem
David Abrahams
dave at boost-consulting.com
Sun Apr 27 20:32:01 EDT 2003
%python imapfilter.py -t -v
Loading database hammie.db... Loading state from hammie.db database
hammie.db is a new database
Done.
Training
Training ham folder HamBox
Traceback (most recent call last):
File "imapfilter.py", line 661, in ?
run()
File "imapfilter.py", line 647, in run
imap_filter.Train()
File "imapfilter.py", line 488, in Train
num_ham_trained = folder.Train(self.classifier, False)
File "imapfilter.py", line 431, in Train
for msg in self:
File "imapfilter.py", line 383, in __iter__
yield self[key]
File "imapfilter.py", line 423, in __getitem__
msg.setId(key)
File "spambayes/message.py", line 173, in setId
msginfoDB._getState(self)
File "spambayes/message.py", line 118, in _getState
(msg.c, msg.t) = self.db[msg.getId()]
File "/usr/home/dave/src/email-2.5/email/Message.py", line 283, in __getitem__
return self.get(name)
File "/usr/home/dave/src/email-2.5/email/Message.py", line 349, in get
name = name.lower()
AttributeError: 'int' object has no attribute 'lower'
What's happening here is in:
File "spambayes/message.py", line 118, in _getState
(msg.c, msg.t) = self.db[msg.getId()]
self.db[msg.getID()]
is a email.Message object which doesn't support indexing by ints, and
the construct
a, b = expr
basically evaluates expr and then tries to treat it as a sequence and
iterate over its elements, grabbing the first two and sticking them
in a and b. I have no idea how or why this works for anyone else; it
seems like a straight-up bug to me, but maybe something went wrong
long before that I'm unable to diagnose.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Spambayes
mailing list