Hi,
I've installed Twisted 15.3.0 on Ubuntu 14.04LTS. Excellent work but there's one problem bothering me for a long time: twisted.mail.imap4.IMAP4Client.fetchMessage always throws exception and the exception occured at random, e.g. somtimes the exception occured when the program read the 120th mail, sometimes it occured at the 150th or 200th mail. The traceback of the exception is as follows:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/internet/posixbase.py", line 597, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/internet/tcp.py", line 209, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/internet/tcp.py", line 215, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/protocols/basic.py", line 571, in dataReceived
why = self.lineReceived(line)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/mail/imap4.py", line 2356, in lineReceived
self._regularDispatch(line)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.3.0-py2.7-linux-i686.egg/twisted/mail/imap4.py", line 2383, in _regularDispatch
tag, rest = parts
exceptions.ValueError: need more than 1 value to unpack
My code is as simple as possible and the exception is thrown by the following codes:
dlist = []
for msg in messages: # use message number, not UID
d = self.fetchMessage(msg, uid=False)
d.addCallback(cbGetAttachment)
dlist.append(d)
dl = defer.DeferredList(dlist)
return dl.addCallback(cbLogout)
Is there anybody know about this issue?