[spambayes-dev] If msg.as_string() fails...

Skip Montanaro skip at pobox.com
Mon May 3 09:13:25 EDT 2004


    Tony> For this particular problem (reports of which are increasing) what
    Tony> about 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)
    ... 

Isn't the code in the except clause more-or-less what msg.as_string() itself
does?

I'll give it some thought.  Do we have a message we know makes this process
barf?  The few I encountered the other day didn't fail on my development
machine which runs Python from CVS and version 2.5.5 of the email package.
The machine on which it failed runs Python 2.2.3 and email 2.5.3.  Maybe
shipping 2.5.5 with Spambayes and installing it is a reasonable alternative.
Didn't we used to ship some version of the email package?  I don't see it
in my CVS sandbox now.

Skip





More information about the spambayes-dev mailing list