This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: email.Maildir cannot roundtrip messages.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: bremner, r.david.murray
Priority: normal Keywords:

Created on 2009-06-27 21:16 by bremner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py bremner, 2009-06-27 21:16
Messages (6)
msg89754 - (view) Author: David Bremner (bremner) Date: 2009-06-27 21:16
if mailbox is an email.Maildir object  the following lines 
cause an exception for me.

for key in mailbox.keys():
	msg=mailbox[key]
        mailbox[key]=msg

I attach the whole script. I'm happy to send a tar file of the maildir
I used to test with.
msg89758 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-06-27 22:05
Please cut and paste the traceback.
msg89760 - (view) Author: David Bremner (bremner) Date: 2009-06-27 23:28
[ 61 pivot ~/config/scripts ] python test.py
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    mailbox[key]=msg
  File "/usr/lib/python2.5/mailbox.py", line 293, in __setitem__
    temp_key = self.add(message)
  File "/usr/lib/python2.5/mailbox.py", line 245, in add
    self._dump_message(message, tmp_file)
  File "/usr/lib/python2.5/mailbox.py", line 220, in _dump_message
    raise TypeError('Invalid message type: %s' % type(message))
TypeError: Invalid message type: <type 'instance'>
msg89781 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-06-28 19:46
Did you specify 'factory=None', as instructed by the documentation? 
(The default is fixed in py3, by the way).
msg89796 - (view) Author: David Bremner (bremner) Date: 2009-06-28 21:49
that seems to fix my test script. Thanks. I guess the bug can be
closed?
msg89797 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-06-28 22:13
Yep :)
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50598
2009-06-28 22:13:11r.david.murraysetstatus: open -> closed
resolution: not a bug
messages: + msg89797

stage: test needed -> resolved
2009-06-28 21:49:29bremnersetmessages: + msg89796
2009-06-28 19:46:03r.david.murraysetmessages: + msg89781
2009-06-27 23:28:59bremnersetmessages: + msg89760
2009-06-27 22:05:26r.david.murraysetpriority: normal

nosy: + r.david.murray
messages: + msg89758

components: + Library (Lib)
stage: test needed
2009-06-27 21:16:26bremnercreate