[spambayes-bugs] [ spambayes-Bugs-942262 ] TypeError: string payload expected: <type 'list'>

SourceForge.net noreply at sourceforge.net
Tue May 25 19:19:54 EDT 2004


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

Category: hammie
Group: 	Binary 1.0b1
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Steven Knight (stevenknight)
Assigned to: Nobody/Anonymous (nobody)
Summary: TypeError: string payload expected: <type 'list'>

Initial Comment:
Both messages in the attached file cause both 1.0a7 and
1.0b1 to die with the following output:

$ sb_mboxtrain.py -d ~/.hammie.db -s ~/Mail/unsure
Training spam (/home/knight/Mail/unsure):
  Reading as Unix mbox
Traceback (most recent call last):
  File "/usr/local/bin/sb_mboxtrain.py", line 351, in ?
    main()
  File "/usr/local/bin/sb_mboxtrain.py", line 342, in main
    train(h, s, True, force, trainnew, removetrained)
  File "/usr/local/bin/sb_mboxtrain.py", line 266, in train
    mbox_train(h, path, is_spam, force)
  File "/usr/local/bin/sb_mboxtrain.py", line 193, in
mbox_train
    outf.write(msg.as_string(True))
  File "/usr/lib/python2.2/email/Message.py", line 107,
in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python2.2/email/Generator.py", line
100, in flatten
    self._write(msg)
  File "/usr/lib/python2.2/email/Generator.py", line
128, in _write
    self._dispatch(msg)
  File "/usr/lib/python2.2/email/Generator.py", line
154, in _dispatch
    meth(msg)
  File "/usr/lib/python2.2/email/Generator.py", line
212, in _handle_text
    raise TypeError, 'string payload expected: %s' %
type(payload)
TypeError: string payload expected: <type 'list'>

This is on a pretty vanilla Red Hat 9 system running
Python 2.2.  If you need any more info, let me know.

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

>Comment By: Tony Meyer (anadelonbrin)
Date: 2004-05-26 11:19

Message:
Logged In: YES 
user_id=552329

For the short term, I've checked in the fix that was applied
to sb_filter (in 1.0rc1) to sb_mboxtrain, which should fix this.

For the medium term, we'll (after 1.0) switch sb_filter and
sb_mboxtrain over to using the spambayes Message class (like
sb_imapfilter, sb_server and sb_pop3dnd) so that fixes like
this only need to be applied in one place.

For the long term, Python 2.4's email package (2.5, IIRC)
handles malformed messages much more gracefully.  This will
be used for binary releases, and will work with people
running the source with Python 2.4.  We might bundle bits of
the code for 2.2/2.3 users; I'm not sure.

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

Comment By: Tim Woodcock (twoodcock)
Date: 2004-05-26 10:53

Message:
Logged In: YES 
user_id=1049836

I found this too, and, with a little experimentation, found
that it was the Content-Type line in the email that made the
difference.

Something does not like the following:
Content-Type: text/html;
        boundary="--1474828438272566"

If you change that to 
Content-Type: multipart/alternative;
        boundary="--1474828438272566"

It processes without errors.

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

Comment By: Jeremy Condit (jcondit)
Date: 2004-05-11 08:19

Message:
Logged In: YES 
user_id=190757

I get the same error on a FreeBSD system running Python 2.2.2.  
It occurs in both 1.0a7 and 1.0b1.1. 
 
I winnowed down my corpus of spam until I found the message 
that was causing the bug.  Deleting this message from my spam 
mailbox eliminated the error.  You can get a copy of the 
offending spam here: 
 
http://bantha.org/~jcondit/badspam.txt 

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

Comment By: Leo Heska (joiner)
Date: 2004-04-27 00:44

Message:
Logged In: YES 
user_id=1029402

I got what appears to be the same error with a different
presentation.  The below came from SpamBayes POP3 Proxy
Version 1.0b1 (April 2004), running on Windows 2000
Professional:

X-Nonspam: None
X-Spambayes-Exception: Traceback (most recent call last):
 .  File "sb_server.pyc", line 474, in onRetr
 .  File "spambayes\message.pyc", line 262, in asTokens
 .  File "spambayes\message.pyc", line 277, in as_string
 .  File "email\Message.pyc", line 130, in as_string
 .  File "email\Generator.pyc", line 102, in flatten
 .  File "email\Generator.pyc", line 130, in _write
 .  File "email\Generator.pyc", line 156, in _dispatch
 .  File "email\Generator.pyc", line 199, in _handle_text
 .TypeError: string payload expected: <type 'list'>

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

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



More information about the Spambayes-bugs mailing list