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.

Author smoser
Recipients smoser
Date 2007-12-12.02:40:55
SpamBayes Score 0.2608546
Marked as misclassified No
Message-id <1197427257.83.0.419655228027.issue1598@psf.upfronthosting.co.za>
In-reply-to
Content
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.
Files
File name Uploaded
imaplib-debug.txt smoser, 2007-12-12.02:40:55
History
Date User Action Args
2007-12-12 02:40:58smosersetspambayes_score: 0.260855 -> 0.2608546
recipients: + smoser
2007-12-12 02:40:57smosersetspambayes_score: 0.260855 -> 0.260855
messageid: <1197427257.83.0.419655228027.issue1598@psf.upfronthosting.co.za>
2007-12-12 02:40:57smoserlinkissue1598 messages
2007-12-12 02:40:56smosercreate