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

noreply@sourceforge.net noreply@sourceforge.net
Sun, 10 Feb 2002 13:33:33 -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: Python 2.2
>Status: Closed
>Resolution: Fixed
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'



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

>Comment By: Barry Warsaw (bwarsaw)
Date: 2002-02-10 13:33

Message:
Logged In: YES 
user_id=12800

Known bug related to declared multipart/*'s with just a
single part.  Fixed in CVS (candidate for 2.2.1); also fixed
in the email/mimelib distro.


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

Comment By: Nobody/Anonymous (nobody)
Date: 2002-02-10 10:59

Message:
Logged In: NO 

I'm also seeing this problem, with a newly generated
multipart mime message built up using email.MIMEBase /
email.MIMEText. For me it only occurs intermittently, but
I'm using external data to build my messages and haven't
tried a fixed set of input yet.



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

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