[Python-bugs-list] [ python-Bugs-500508 ] problems printing multipart MIME msg

noreply@sourceforge.net noreply@sourceforge.net
Mon, 07 Jan 2002 10:46:10 -0800


Bugs item #500508, was opened at 2002-01-07 10:46
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=500508&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Barry Warsaw (bwarsaw)
Summary: problems printing multipart MIME msg

Initial Comment:
Got this from python-help.  A user there is trying
to use the email 
module to display multipart MIME
messages generated by mutt.  
Attached is a specific
mail message.  Using this simple 
script

>>> import email
>>> f = open("spam1")
>>> 
msg=email.message_from_file(f)
>>> print msg

generates 
this traceback

Traceback (most recent call last):
  File 
"<stdin>", line 1, in ?
  File 
"/usr/local/lib/python2.2/email/Message.py", line 49, in 
__str__
    return self.as_string(unixfrom=1)
  File 
"/usr/local/lib/python2.2/email/Message.py", line 59, in 
as_string
    g(self, unixfrom=unixfrom)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 83, in 
__call__
    self._write(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 104, 
in _write
    self._dispatch(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 134, 
in _dispatch
    meth(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 243, 
in _handle_multipart
    g(part, unixfrom=0)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 83, in 
__call__
    self._write(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 104, 
in _write
    self._dispatch(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 134, 
in _dispatch
    meth(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 310, 
in _handle_message
    g(msg.get_payload(), unixfrom=0)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 83, in 
__call__
    self._write(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 104, 
in _write
    self._dispatch(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 134, 
in _dispatch
    meth(msg)
  File 
"/usr/local/lib/python2.2/email/Generator.py", line 240, 
in _handle_multipart
    for part in msg.get_payload():
  File 
"/usr/local/lib/python2.2/email/Message.py", line 151, in 
__getitem__
    return self.get(name)
  File 
"/usr/local/lib/python2.2/email/Message.py", line 214, in 
get
    name = name.lower()
AttributeError: 'int' object has no 
attribute 'lower'



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=500508&group_id=5470