[spambayes-dev] RE: [Email-SIG] Maybe a bug, maybe not

Tony Meyer t-meyer at ihug.co.nz
Mon May 3 21:29:34 EDT 2004


> I'm copying the spambayes list 
> since people started reporting this problem on this list too.

I've moved this to cc spambayes-dev instead, because we're already
discussing this there, and it'll just get lost in the bug reports on the
main list.

> I suspect that the crash occur because these messages have 
> multipart boundaries but have a text content type header. 

That seems to be correct.

Two additional notes:

Skip Montanaro thinks that he had a message like this fail with Python 2.2.3
and email 2.5.3, but work fine with Python from CVS and version 2.5.5 of the
email package, so that might be worth looking into.  He's going to check
whether this is the case or not.

For SpamBayes (and so presumably other apps that use the email package like
this) we're either going to (again) include a more up-to-date/patched
version of the email package, or handle the exception in our code.  Adding
something like this:

    >>> try:
    ...         print msg.as_string()
    ... except TypeError:
    ...         parts = []
    ...         for part in msg.get_payload():
    ...                 parts.append(part.as_string())
    ...         print "\n".join(parts)
    ... 

works for me (obviously msg is an email.Message or similar, and you change
print to whatever you want it to be).  Adding this to the two spambayes
modules that need it may be simpler for us than including a patched email
package.

=Tony Meyer




More information about the spambayes-dev mailing list