[Email-SIG] why is this HeaderParseError being raised?
Jason R. Mastaler
jason at mastaler.com
Tue Oct 10 22:12:10 CEST 2006
I'm probably missing something obvious, but can someone tell me why
email.header.decode_header() is blowing up when trying to decode the
Subject header of this message? It looks legitimate to me. It's not
a spam message, and was prodcued by Microsoft Outlook Express:
http://mastaler.com/tmp/1150650768.21756.msg.txt
I'm reproducing it with this code:
Python 2.5 (r25:51908, Sep 21 2006, 13:04:20)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.parser import Parser
>>> from email.header import decode_header
>>> msg = Parser().parse(open('1150650768.21756.msg.txt'))
>>> subject = decode_header(msg['subject'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/sw/lib/python2.5/email/header.py", line 100, in decode_header
raise HeaderParseError
email.errors.HeaderParseError
>>>
More information about the Email-SIG
mailing list