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.

Author msapiro
Recipients barry, msapiro, r.david.murray
Date 2016-06-14.18:52:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465930372.53.0.0254623453508.issue27321@psf.upfronthosting.co.za>
In-reply-to
Content
The attached file, bad_email, can be parsed via

msg = email.message_from_binary_file(open('bad_email', 'rb'))

but then msg.as_string() prodices the following:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/email/message.py", line 159, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python3.5/email/generator.py", line 115, in flatten
    self._write(msg)
  File "/usr/lib/python3.5/email/generator.py", line 189, in _write
    msg.replace_header('content-transfer-encoding', munge_cte[0])
  File "/usr/lib/python3.5/email/message.py", line 559, in replace_header
    raise KeyError(_name)
KeyError: 'content-transfer-encoding'
History
Date User Action Args
2016-06-14 18:52:52msapirosetrecipients: + msapiro, barry, r.david.murray
2016-06-14 18:52:52msapirosetmessageid: <1465930372.53.0.0254623453508.issue27321@psf.upfronthosting.co.za>
2016-06-14 18:52:52msapirolinkissue27321 messages
2016-06-14 18:52:52msapirocreate