[New-bugs-announce] [issue42892] AttributeError in email.message.get_body()

Xavier Hausherr report at bugs.python.org
Mon Jan 11 11:45:57 EST 2021

New submission from Xavier Hausherr <xavier at shipfix.com>:

Following this issue: https://bugs.python.org/issue33972

Same bug apply to email.message.get_body() with attached email example and the following code: 

        from email.policy import default
        import email

        with open('email_bad_formatted.eml', 'rb') as fp:
            msg = email.message_from_binary_file(fp, policy=default)
        body = msg.get_body()

> Result:
E       AttributeError: 'str' object has no attribute 'is_attachment'

/usr/local/lib/python3.9/email/message.py:978: AttributeError

components: email
files: email_bad_formatted.eml
messages: 384847
nosy: barry, iritkatriel, r.david.murray, xavier2
priority: normal
severity: normal
status: open
title: AttributeError in email.message.get_body()
versions: Python 3.9
Added file: https://bugs.python.org/file49734/email_bad_formatted.eml

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list