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: Python 3 MIME generator dies if not given boundary
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Faster output if message already has a boundary
View: 1243654
Assigned To: Nosy List: SilentGhost, brandon-rhodes
Priority: normal Keywords: patch

Created on 2011-01-13 17:22 by brandon-rhodes, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
email-boundary.diff brandon-rhodes, 2011-01-13 17:24
Messages (3)
msg126187 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2011-01-13 17:22
If you try doing "msg.as_string()" to a MIMEMultipart message that has not been given a boundary, then it dies with this exception:

Traceback (most recent call last):
  File "mime_gen_alt.py", line 40, in <module>
    print(msg.as_string())
  File "/home/brandon/python3.2b2/lib/python3.2/email/message.py", line 164, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/home/brandon/python3.2b2/lib/python3.2/email/generator.py", line 88, in flatten
    self._write(msg)
  File "/home/brandon/python3.2b2/lib/python3.2/email/generator.py", line 134, in _write
    self._dispatch(msg)
  File "/home/brandon/python3.2b2/lib/python3.2/email/generator.py", line 160, in _dispatch
    meth(msg)
  File "/home/brandon/python3.2b2/lib/python3.2/email/generator.py", line 234, in _handle_multipart
    self.write('--' + boundary + self._NL)
TypeError: Can't convert 'NoneType' object to str implicitly
msg126188 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2011-01-13 17:24
Here is a patch that fixes the problem. The problem probably only occurs if the MIMEMultipart is actually given several MIME parts to use in its interior.
msg126189 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2011-01-13 17:47
It is a duplicate of #1243654. Closing.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55110
2011-01-13 17:47:02SilentGhostsetstatus: open -> closed

nosy: + SilentGhost
messages: + msg126189

superseder: Faster output if message already has a boundary
resolution: duplicate
2011-01-13 17:24:38brandon-rhodessetfiles: + email-boundary.diff

messages: + msg126188
keywords: + patch
2011-01-13 17:22:24brandon-rhodescreate