[spambayes-bugs] [ spambayes-Bugs-963134 ] sb_mboxtrain.py fails to output some messages

SourceForge.net noreply at sourceforge.net
Sun May 30 19:27:24 EDT 2004


Bugs item #963134, was opened at 2004-05-31 01:57
Message generated for change (Comment added) made by anadelonbrin
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=963134&group_id=61702

Category: None
Group: Source code 1.0rc1
Status: Open
Resolution: None
Priority: 5
Submitted By: Doug Hellmann (doughellmann)
Assigned to: Nobody/Anonymous (nobody)
Summary: sb_mboxtrain.py fails to output some messages

Initial Comment:
Apparently some messages which can be processed by
sb_mboxtrain.py cannot be converted back to text to be
written to the output file.  An example traceback is:

Training spam (/path/to/mailbox):
  Reading as Unix mbox
    270Traceback (most recent call last):
  File "/usr/local/bin/sb_mboxtrain.py", line 315, in ?
    main()
  File "/usr/local/bin/sb_mboxtrain.py", line 306, in main
    train(h, s, True, force, trainnew, removetrained)
  File "/usr/local/bin/sb_mboxtrain.py", line 230, in train
    mbox_train(h, path, is_spam, force)
  File "/usr/local/bin/sb_mboxtrain.py", line 162, in
mbox_train
    outf.write(msg.as_string(True))
  File "/usr/local/lib/python2.3/email/Message.py",
line 130, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 102, in flatten
    self._write(msg)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 130, in _write
    self._dispatch(msg)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 156, in _dispatch
    meth(msg)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 199, in _handle_text
    raise TypeError, 'string payload expected: %s' %
type(payload)
TypeError: string payload expected: <type 'list'>

See attached for an mbox will several sample messages
that produce this problem and a (overly) simple patch
to sb_mboxtrain.py that at least works around the problem.

----------------------------------------------------------------------

>Comment By: Tony Meyer (anadelonbrin)
Date: 2004-05-31 11:27

Message:
Logged In: YES 
user_id=552329

This particular problem (the one that raises TypeError) is
handled by mboxtrain in cvs, so will not be a problem from
the next release.  Longer term, the Python email package 2.5
(in Python 2.4) is much better at handling malformed
messges, so that will solve a lot of these problems
(assuming that you can move to that, or that we bundle the
necessary bit).

What mboxtrain actually does when it fails is another issue,
though, which I'm not at all qualified to decide.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=963134&group_id=61702



More information about the Spambayes-bugs mailing list