Hi,

> Traceback (most recent call last):
>  File "./test_mbox.py", line 6, in <module>
>    if mbox_file.items() != []:
>  File "/usr/lib/python3.8/mailbox.py", line 132, in items
>    return list(self.iteritems())
>  File "/usr/lib/python3.8/mailbox.py", line 125, in iteritems
>    value = self[key]
>  File "/usr/lib/python3.8/mailbox.py", line 73, in __getitem__
>    return self.get_message(key)
>  File "/usr/lib/python3.8/mailbox.py", line 781, in get_message
>    msg.set_from(from_line[5:].decode('ascii'))
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 37: 
> ordinal not in range(128)
> Exit code:   1 

For me the error goes way for me when I change line 781 in 
/usr/lib/python3.8/mailbox.py
 to:

msg.set_from(from_line[5:].decode('utf-8'))

May be this is a minor feature enhancement since at the moment messages with 
unicodes don't seem to be decoded.
Or there's an API change which I'm not aware of.

Either way this should act like a temorary fix for now. Let me know if this 
doesn't seem right.

Kinds Regards,
Nilesh

Reply via email to