This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Problem With email.MIMEText Package
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, judasiscariot
Priority: normal Keywords:

Created on 2003-05-12 09:41 by judasiscariot, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
NotWorking.py judasiscariot, 2003-05-15 09:30 Function With Offending Code
Config.ini judasiscariot, 2003-05-21 08:13 Config File
PostITControl.py judasiscariot, 2003-05-21 08:14 Client Script (This Crashes With The MIMEText Error)
ServerMonitor.py judasiscariot, 2003-05-21 08:16 Server Script
BareMail.py judasiscariot, 2004-03-22 11:35 Bare Minimum Class To Show Error
Messages (13)
msg15967 - (view) Author: John Abel (judasiscariot) Date: 2003-05-12 09:41
Problem with email.MIMEText.  I created a MIMEText
message (following the example in the documentation). 
The problem occurs when as_string() is called.  This is
the traceback:

  File "/usr/local/lib/python2.3/email/Message.py",
line 113, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 102, in flatten
    self._write(msg)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 137, in _write
    self._write_headers(msg)
  File "/usr/local/lib/python2.3/email/Generator.py",
line 183, in _write_headers
    header_name=h, continuation_ws='\t').encode()
  File "/usr/local/lib/python2.3/email/Header.py", line
415, in encode
    return self._encode_chunks(newchunks, maxlinelen)
  File "/usr/local/lib/python2.3/email/Header.py", line
375, in _encode_chunks
    _max_append(chunks, s, maxlinelen, extra)
  File "/usr/local/lib/python2.3/email/quopriMIME.py",
line 84, in _max_append
    L.append(s.lstrip())
AttributeError: 'list' object has no attribute 'lstrip'

I'm using 2.3b1, on RH9.  The same piece of code works
with 2.2.2.
msg15968 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-05-13 15:45
Logged In: YES 
user_id=12800

Can you upload the exact code that you wrote that caused
this crash?  Please don't paste it.
msg15969 - (view) Author: John Abel (judasiscariot) Date: 2003-05-15 09:32
Logged In: YES 
user_id=221478

Sorry, forgot the comment.  When running the script using
python2.2 (email 2.4.3), I don't receive any errors, mail
gets sent.  It only seems to happen with 2.3b.
msg15970 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-05-15 14:07
Logged In: YES 
user_id=12800

Sorry, the attached code sample is incomplete.  It is not
sufficient for me to reproduce the problem.

Please boil down your example to a self-contained -- but as
small as possible -- example.
msg15971 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-05-19 19:59
Logged In: YES 
user_id=12800

I'm moving this to Pending since wthout more information I
can't help. This starts the 14 day clock ticking.  After 2
weeks this bug report will be closed, unless someone follows
up with more information.
msg15972 - (view) Author: John Abel (judasiscariot) Date: 2003-05-21 08:13
Logged In: YES 
user_id=221478

Sorry, been trying to narrow the code down.  If I have a
bare minimum script, it works, yet the original still fails.
 I'll upload the required files (3).
msg15973 - (view) Author: John Abel (judasiscariot) Date: 2003-05-21 08:16
Logged In: YES 
user_id=221478

The Config.ini will need to modifying to suit your machine
settings.  Run the ServerMonitor.py, and then run
PostITControl.py.  PostITControl.py crashes when trying to
send a mail.
msg15974 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-09-03 12:15
Logged In: YES 
user_id=12800

Sorry, but you're going to have to work harder at trying to
boil down the buggy code.  When I run ServerMonitor.py, I
get an immediate traceback

Traceback (most recent call last):
  File "ServerMonitor.py", line 18, in ?
    import ThreadUtils, NetMon
ImportError: No module named ThreadUtils

Here's one thing you can try to do: catch the exception in
your code, then pickle the Message object up and post the
pickle.  I can at least reconstitute the pickle and look at
the structure.

Also, I'm guessing the problem is somewhere in ProcessMail()
in PostITControl.py.  Be sure that the mailBody argument is
a string and nothing else.
msg15975 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-11-21 20:29
Logged In: YES 
user_id=12800

There have no follow ups to this message in months, so I'm
moving it to Pending status.
msg15976 - (view) Author: John Abel (judasiscariot) Date: 2004-03-22 11:35
Logged In: YES 
user_id=221478

OK, stripped everything down to a minimum.  I now have a
class, based upon the example from the email docs.  It still
gives the same error, when mailMessage.as_string() is called.
msg15977 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2004-05-10 15:13
Logged In: YES 
user_id=12800

I need to know what the value of oldFiles is when you run
BareMail.py.  I've had no problems with this example, but I
suppose it's possible you might if you were running on a
system with unicode file names and there were some funky
characters in your file names.

FWIW, this code works fine for me in Python 2.3.3 and Python
2.4cvs.  I'm re-pending this bug report for more information.
msg15978 - (view) Author: John Abel (judasiscariot) Date: 2004-07-23 07:51
Logged In: YES 
user_id=221478

Since upgrading to 2.3.4, this problem has gone away.  I
have a 2.3.2 version somewhere, so I'll test on that, if
that helps?
msg15979 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2004-07-23 14:30
Logged In: YES 
user_id=12800

Probably not.  If the problem doesn't occur for you in 2.3.4
then consider it fixed :)
History
Date User Action Args
2022-04-10 16:08:42adminsetgithub: 38484
2003-05-12 09:41:06judasiscariotcreate