Is it a bug (or a feature)?
Roman Suzi
rnd at onego.ru
Wed Aug 25 07:53:27 EDT 2004
In Python2.3.4:
>>> em = email.message_from_file(open('MAILMESSAGE'))
>>> for i in em:
... print i
...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/email/Message.py",
line
304, in __getitem__
File "/usr/lib/python2.3/email/Message.py",
line
370, in get
AttributeError: 'int' object has no attribute 'lower'
However items() does work:
>>> for i in em.items():
... print i
...
('Date', '24 Aug 2004 16:06:01 +0400')
('From', 'Mail System Internal Data <MAILER-DAEMON at mydomain.ru>')
('Subject', "DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA")
('Message-ID', '<1095549161 at mydomain.ru>')
('X-IMAP', '1095527634 0000000005')
('Status', 'RO')
I can probably guess why this happens ('cause multiple fields with the
same names are possible), but .items() is broken by this... It needn't
be!
Sincerely yours, Roman A.Suzi
--
- Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
More information about the Python-list
mailing list