How do I get a mimetools.Message object from a mailbox.UnixMailbox object?

Ben Wolfson wolfson at midway.uchicago.edu
Mon Jan 8 13:13:22 EST 2001


In article <vgmh5tkv7h0blpv6j8t1soiipoaum64u7v at 4ax.com>,
Paul Moore  <gustav at morpheus.demon.co.uk> wrote:
>I'm parsing a Unix mbox format file in Python. No problem, that's what
>the mailbox module does...
>
>The problem is, mbx.next() returns a rfc822.Message instance - and my
>mailbox contains MIME-encoded messages with attachments. How do I get
>from the rfc822.Message instance to a mimetools.Message instance?

I don't know how well this will work, and it seems rather unsavory,
but:

>>> import mailbox
>>> import mimetools
>>> mailbox.rfc822.Message = mimetools.Message
>>> mailbox.rfc822.Message
<class mimetools.Message at 00B603BC>



-- 
Barnabas T. Rumjuggler
I say, an object can move whether or not an "external (male, masculine) 
force" chooses to act upon (rape) it!
 -- David Zacuto



More information about the Python-list mailing list