Vajrasky Kok added the comment: The Parse class does not throw exception if given invalid message:
Assume /tmp/a.txt contains garbage, such as: "&&&&&" With this code: with open("/tmp/a.txt", "r") as fp: msg = email.parser.Parser().parse(fp) # does not throw exception print(msg) # => &&&&& msg['from'] # => None It is just you can not get useful information, such as msg['to']. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21476> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com