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 enrico
Recipients enrico
Date 2019-03-04.11:03:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551697417.39.0.601639302301.issue36180@roundup.psfhosted.org>
In-reply-to
Content
This simple code:

```
import mailbox

mbox = mailbox.mbox("broken.mbox")
for msg in mbox:
    msg.get_payload()
```

Fails rather unexpectedly:

```
$ python3 broken.py 
Traceback (most recent call last):
  File "broken.py", line 5, in <module>
    msg.get_payload()
  File "/usr/lib/python3.7/email/message.py", line 267, in get_payload
    payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
TypeError: decode() argument 1 must be str, not tuple
```

(I'm attaching a zip with code and mailbox)

I would have expected either that the part past text/plain is ignored if it doesn't make sense, or that content-type is completely ignored.

I have to process a large mailbox archive, and this is currently how I had to work around this issue, and it's causing me to have to skip email content which would otherwise be reasonably accessible:

https://salsa.debian.org/nm-team/echelon/commit/617ce935a31f6256257ffb24e11a5666306406c3
History
Date User Action Args
2019-03-04 11:03:37enricosetrecipients: + enrico
2019-03-04 11:03:37enricosetmessageid: <1551697417.39.0.601639302301.issue36180@roundup.psfhosted.org>
2019-03-04 11:03:37enricolinkissue36180 messages
2019-03-04 11:03:37enricocreate