Is this a mimetools/rfc822 bug?

Andy andy at mindgate.net
Mon Jun 25 15:09:16 EDT 2001


samplemsg="""Date: Fri, 04 May 2001 14:29:01 +0200
From: Lars Degerstedt <lars.degerstedt at telia.com>
To: java-linux <java-linux at java.blackdown.org>
Subject: Stacktraces without line numbering?
Message-ID: <3AF2A08D.9C4ACF38 at telia.com>
Content-Type: multipart/mixed;
 boundary="------------F801EFF1B3CEC2D197CE3D3F"

This is a multi-part message in MIME format.
--------------F801EFF1B3CEC2D197CE3D3F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Blah Blah
--------------F801EFF1B3CEC2D197CE3D3F
Content-Type: text/x-vcard; charset=us-ascii;
 name="lars.degerstedt.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Lars Degerstedt
Content-Disposition: attachment;
 filename="lars.degerstedt.vcf"

blah blah
--------------F801EFF1B3CEC2D197CE3D3F--
"""

import StringIO, mimetools


msgstream=StringIO.StringIO(samplemsg)
email=mimetools.Message(msgstream)
print email.gettype()


works fine.  But when there are leading newlines in samplemsg, it can't read
the headers anymore.  (Of course, you can always use lstrip... but it took
me a while before I found out - not a typical Python experience...)










More information about the Python-list mailing list