[New-bugs-announce] [issue1598] unexpected response in imaplib

Scott Moser report at bugs.python.org
Wed Dec 12 03:40:57 CET 2007

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.  

import getpass, imaplib

M = imaplib.IMAP4("my.imap.host.tld")
M.login(getpass.getuser(), getpass.getpass())
M.debug = 5
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])

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

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 <report at bugs.python.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: imaplib-debug.txt
Url: http://mail.python.org/pipermail/new-bugs-announce/attachments/20071212/08190f22/attachment.txt 

More information about the New-bugs-announce mailing list