[Python-bugs-list] [ python-Bugs-588202 ] MIMEBase as_string fails with 1 attchmnt

noreply@sourceforge.net noreply@sourceforge.net
Tue, 30 Jul 2002 07:17:28 -0700


Bugs item #588202, was opened at 2002-07-29 14:19
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=588202&group_id=5470

Category: Python Library
Group: Python 2.2
>Status: Closed
>Resolution: Out of Date
Priority: 5
Submitted By: Moshe Yudkowsky (myudkowsky)
Assigned to: Nobody/Anonymous (nobody)
Summary: MIMEBase as_string fails with 1 attchmnt

Initial Comment:
I get an exception when I create a multipart MIMEBase
message: if the number of attachments is less than 2,
Generator.py throws an exception.

Procedule:

1. import email.MIMEBase, email.MIMEText

2. create instance of MIMEText, e.g.,

t=email.MIMEText.MIMEText("some data")

3. t.as_string() prints out text

4. Create an instance of MIMEBase -- let's use:

b=MIMEBase('multipart','mixed')

5. b.as_string() throws an exception in Generator.py

6. add preamble, epilogue -- it still fails

7. attach something to the MIMEBase instance:

b.attach(t)

8. b.as_string() still fails, this time throwing an
exception in Message.py.

9. Attach a second attachment:

b.attach(t)

(same atttachment twice will do)

10. b.as_string() works

I regret that this time I do not have a proposed fix,
as I had a little trouble deciphering the traceback and
time pressure prevents me from running the debugger
just now. If need be I expect you can assign this to me
to find a fix.



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

>Comment By: Moshe Yudkowsky (myudkowsky)
Date: 2002-07-30 09:17

Message:
Logged In: YES 
user_id=288768

Never mind, I just found this in the 2.2.1 documentation:

"The email package bug #531966 was fixed.  This caused
exceptions to occur when flattening multipart/* messages
with zero or one (scalar)  attachment."

If this still fails in 2.2.1 I will resubmit.

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

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