[Email-SIG] Non-string headers
Oleg Broytmann
phd at phd.pp.ru
Wed Apr 21 03:40:08 EDT 2004
On Tue, Apr 20, 2004 at 03:23:25PM -0400, Barry Warsaw wrote:
> Actually, all header names are converted to strings, via modulo
> operator.
Huh?
from email import MIMEText
msg = MIMEText.MIMEText("This is a simple message", _charset="latin-1")
msg["Subject"] = "Text"
msg[1] = "test"
print str(msg)
Traceback (most recent call last):
File "./text.py", line 10, in ?
print str(msg)
File "/usr/local/lib/python2.3/email/Message.py", line 116, in __str__
return self.as_string(unixfrom=True)
File "/usr/local/lib/python2.3/email/Message.py", line 130, in as_string
g.flatten(self, unixfrom=unixfrom)
File "/usr/local/lib/python2.3/email/Generator.py", line 103, in flatten
self._write(msg)
File "/usr/local/lib/python2.3/email/Generator.py", line 138, in _write
self._write_headers(msg)
File "/usr/local/lib/python2.3/email/Generator.py", line 184, in _write_headers
header_name=h, continuation_ws='\t').encode()
File "/usr/local/lib/python2.3/email/Header.py", line 198, in __init__
self._firstlinelen = maxlinelen - len(header_name) - 2
TypeError: len() of unsized object
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Email-SIG
mailing list