imap2maildir
imap2maildir copied to clipboard
TypeError in parseFetch
When trying imap2maildir for the first time, I find it first downloads many (perhaps all) all of the messages and then crashes with the exception.
TypeError: expected string or buffer
If I repeat it, then it crashes immediately (although if new messages have appeared in the meantime it might download them, I haven't checked). I am running commit 9d8a6efd3, under Python v 2.7.2, on Ubuntu 11.10, the connection is IMAP over SSL.
I'd send a more complete log and a stack trace if I knew where to post it, but in short, the problem is that the "text" parameter to __simplebase.parseFetch
is a tuple rather than a string. the value is:
text[0] == '182 (UID 183 RFC822.SIZE 3297 INTERNALDATE "08-Dec-2011 16:40:03 +0100" ENVELOPE ("Thu, 8 Dec 2011 16:40:03 +0100" {79}'
text[1] == (the subject line of one of my emails)
This tuple is the first "data" element returned from the FETCH command in get_summary_by_uid. My reading of the imaplib documentation makes me expect a tuple in this situation (although unbalanced parentheses in text[0] surprises me).
Finally I can't get away with simple tricks like, sending data[0][0] or ' '.join(data[0]) to parseFetch -- there seems to be some nontrivial change in format. My imaplib.py says it's version is 2.58
Cheers.
Same issue, with 1ad407e on python 2.6.6 :
Traceback (most recent call last):
File "./imap2maildir", line 579, in <module>
main()
File "./imap2maildir", line 560, in main
seencache=seencache)
File "./imap2maildir", line 475, in copy_messages_by_folder
for i in folder.Summaries(search=search):
File "/root/rtucker-imap2maildir-1ad407e/simpleimap.py", line 421, in Summaries
summ = self.__parent.get_summary_by_uid(u)
File "/root/rtucker-imap2maildir-1ad407e/simpleimap.py", line 307, in get_summary_by_uid
return self.parse_summary_data(data)
File "/root/rtucker-imap2maildir-1ad407e/simpleimap.py", line 326, in parse_summary_data
fetchresult = self.parseFetch(data[0])
File "/root/rtucker-imap2maildir-1ad407e/simpleimap.py", line 57, in parseFetch
simple = simple_re.match(text[pos:])
TypeError: expected string or buffer