New submission from Scott Moser: I'm running into a problem with imaplib where it is unable to download a message. The example code at http://www.python.org/doc/current/lib/imap4-example.html easily demonstrates the problem.
#!/usr/bin/python import getpass, imaplib M = imaplib.IMAP4("my.imap.host.tld") M.login(getpass.getuser(), getpass.getpass()) M.debug = 5 M.select("msg-test") typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') print 'Message %s\n%s\n' % (num, data[0][1]) M.close() M.logout() The majority of the messages transfer correctly, but some do not. I've put 3 messages in the 'msg-test' folder, and one of them causes the error below. Traceback (most recent call last): File "test.py", line 9, in <module> typ, data = M.fetch(num, '(RFC822)') File "/usr/lib/python2.5/imaplib.py", line 437, in fetch typ, dat = self._simple_command(name, message_set, message_parts) File "/usr/lib/python2.5/imaplib.py", line 1055, in _simple_command return self._command_complete(name, self._command(name, *args)) File "/usr/lib/python2.5/imaplib.py", line 887, in _command_complete raise self.abort('command: %s => %s' % (name, val)) imaplib.abort: command: FETCH => unexpected response: ')' imaplib.py has a comment in _get_tagged_response: # Some have reported "unexpected response" exceptions. # Note that ignoring them here causes loops. # Instead, send me details of the unexpected response and # I'll update the code in `_get_response()'. I can not provide access to the imap host, but I can help debug wherever possible. The most recent log messages are in the file attachment. ---------- components: Library (Lib) files: imaplib-debug.txt messages: 58482 nosy: smoser severity: normal status: open title: unexpected response in imaplib type: crash versions: Python 2.5 Added file: http://bugs.python.org/file8929/imaplib-debug.txt __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1598> __________________________________
34:14.41 > DPAP7 FETCH 4 (RFC822) 34:14.46 < * 4 FETCH (RFC822 {3721} 34:14.46 matched r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?' => ('4', 'FETCH', ' (RFC822 {3721}', '(RFC822 {3721}') 34:14.46 matched r'.*{(?P<size>\d+)}$' => ('3721',) 34:14.46 read literal size 3721 34:14.55 untagged_responses[FETCH] 0 += ["('4 (RFC822 {3721}', '...3883 bytes total..')"] 34:14.55 < r questions. **** 34:14.55 untagged_responses[FETCH] 1 += ["r questions. ****"] 34:14.55 < ) 34:14.55 last 10 IMAP4 interactions: 34:08.94 < * 4 EXISTS 34:08.94 < * 0 RECENT 34:08.94 < * OK [UIDVALIDITY 25] UIDs valid 34:08.94 < * OK [UIDNEXT 6] Predicted next UID 34:08.94 < * FLAGS (\Flagged \Seen \Answered \Deleted \Draft) 34:08.94 < * OK [PERMANENTFLAGS (\Flagged \Seen \Answered \Deleted \Draft \*)] Permanent flags 34:08.94 < DPAP2 OK [READ-WRITE] SELECT completed 34:08.94 > DPAP3 SEARCH ALL 34:08.99 < * SEARCH 1 2 3 4 34:08.99 < DPAP3 OK SEARCH completed the string 'r questions. ****' above is the last part of the message.
_______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com