printing email parts of type message/external-body??

Magnus Therning magnus.therning at wanadoo.nl
Mon Apr 21 14:16:46 EDT 2003


Peter Hansen <peter at engcorp.com> wrote:
> Magnus Therning wrote:
>> 
>> I am having problems with the following piece of code, would appreciate
>> any insight that can be offered!
>> 
>> ---- test.py ------------
>> from email.Message import Message
>> 
>> meb_message = Message()
>> meb_message.add_header('Content-Type', 'message/external-body',
>>     access_type='local-file')
>> meb_message.set_payload('name="test"\n')
>> print meb_message
>> -------------------------
>> magnus at die:[test].$ python test.py
>> 
>> Traceback (most recent call last):
>>    g.flatten(msg.get_payload(0), unixfrom=False)
>>  File "/usr/lib/python2.2/email/Message.py", line 179, in get_payload
>>    raise TypeError, i
>> TypeError: 0
> 
> Almost looks like a bug.  According to email.Message's documentation,
> a TypeError will be raised by get_payload() if an index parameter is
> provided but the payload is a string, as in this case.

But no index is given, so that would indicate a bug, right?

Well, unfortunately it doesn't bring me any closer to a solution :( Are
there no pyton based MUAs that would have run into this problem already?

/M

-- 
Magnus Therning                    (OpenPGP: 0x6A83A7DF)

Discovery consists of seeing what everybody has seen and thinking what
nobody has thought.
     -- Albert Szent-Gyorgyi




More information about the Python-list mailing list