New submission from Steffen Daode Nurpmeso <sdao...@googlemail.com>:

This snippet (for #11684, but it's simply BytesParser with
headersonly=True in the end)


        with openfile('msg_46.txt', 'rb') as fp:
            msgdata = fp.read()
        parser = email.parser.BytesHeaderParser()
        msg = parser.parsebytes(msgdata)
        out = BytesIO()
        gen = email.generator.BytesGenerator(out)
        gen.flatten(msg)
        self.assertEqual(out.getvalue(), msgdata)


causes this error:


ERROR: test_byte_message_rfc822_only (test_email.TestMessageAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_email/test_email.py", line 
200, in test_byte_message_rfc822_only
    gen.flatten(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 91, 
in flatten
    self._write(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 
137, in _write
    self._dispatch(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 
163, in _dispatch
    meth(msg)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 
304, in _handle_message
    self._fp.write(payload)
TypeError: 'str' does not support the buffer interface

----------
components: Library (Lib)
messages: 133128
nosy: sdaoden
priority: normal
severity: normal
status: open
title: email.generator.Generator.flatten() fails
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11782>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to