嗨我突然遇到一個錯誤,使用imaplib上的一些代碼,以前工作正常。python imaplib - 錯誤'意想不到的repsonse'
import imaplib
m = imaplib.IMAP4('myserver','port')
m.login(r'username','password')
m.select()
給我的錯誤
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/imaplib.py", line 649, in select
typ, dat = self._simple_command(name, mailbox)
File "/usr/lib/python2.7/imaplib.py", line 1070, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/usr/lib/python2.7/imaplib.py", line 899, in _command_complete
raise self.abort('command: %s => %s' % (name, val))
imaplib.abort: command: SELECT => unexpected response: '* 1520 EXISTS'
我不知道這意味着什麼。否則電子郵件通過罰款,我使用davmail作爲服務器。
該程序完整保存附件在特定文件夾中的某個名稱。
我已經通過了它,它的確是m.select()
這是它摔倒的地方。
直到最近,這個程序還是非常好的。
我在做什麼錯,我該如何解決?
活動的日誌如下
>>> import imaplib
>>> m = imaplib.IMAP4('server','port')
>>> Debug=4
>>> m.debug
0
>>> m.debug=4
>>> m.debug
4
>>> m.login(r'username','password')
01:26.55 > HLFI1 LOGIN "username" "password"
01:30.76 < HLFI1 OK Authenticated
('OK', ['Authenticated'])
>>> m.list()
01:56.33 > HLFI2 LIST "" *
02:00.04 < * LIST (\HasNoChildren) "/" "Trash/Sent Messages"
02:00.04 < * LIST (\HasNoChildren) "/" "Sync Issues/Server Failures"
02:00.04 < * LIST (\HasNoChildren) "/" "Sync Issues/Local Failures"
02:00.04 < * LIST (\HasNoChildren) "/" "Sync Issues/Conflicts"
02:00.04 < * LIST (\HasChildren) "/" "Sync Issues"
02:00.04 < * LIST (\HasNoChildren) "/" "Junk E-mail"
02:00.04 < * LIST (\HasNoChildren) "/" "Drafts"
02:00.04 < * LIST (\HasChildren) "/" "Trash"
02:00.04 < * LIST (\HasNoChildren) "/" "Sent"
02:00.04 < * LIST (\HasNoChildren) "/" "Outbox"
02:00.04 < * LIST (\HasNoChildren) "/" "INBOX"
02:00.04 < HLFI2 OK LIST completed
('OK', ['(\\HasNoChildren) "/" "Trash/Sent Messages"', '(\\HasNoChildren) "/" "Sync Issues/Server Failures"', '(\\HasNoChildren) "/" "Sync Issues/Local Failures"', '(\\HasNoChildren) "/" "Sync Issues/Conflicts"', '(\\HasChildren) "/" "Sync Issues"', '(\\HasNoChildren) "/" "Junk E-mail"', '(\\HasNoChildren) "/" "Drafts"', '(\\HasChildren) "/" "Trash"', '(\\HasNoChildren) "/" "Sent"', '(\\HasNoChildren) "/" "Outbox"', '(\\HasNoChildren) "/" "INBOX"'])
>>> m.select()
02:21.37 > HLFI3 SELECT INBOX
02:30.87 < * 1548 EXISTS
02:30.87 last 4 IMAP4 interactions:
00:16.73 < * OK [CAPABILITY IMAP4REV1 AUTH=LOGIN MOVE] IMAP4rev1 DavMail 4.3.0-2125 server ready
00:16.73 > HLFI0 CAPABILITY
00:16.74 < * CAPABILITY IMAP4REV1 AUTH=LOGIN MOVE
00:16.77 < HLFI0 OK CAPABILITY completed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/imaplib.py", line 649, in select
typ, dat = self._simple_command(name, mailbox)
File "/usr/lib/python2.7/imaplib.py", line 1070, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/usr/lib/python2.7/imaplib.py", line 899, in _command_complete
raise self.abort('command: %s => %s' % (name, val))
imaplib.abort: command: SELECT => unexpected response: '* 1548 EXISTS'
**更新**
我現在的python-dev的
大衛提交下一個bug默裏表示,答覆是不符合RFC的
d在davmail SourceForge上
下的第二中號guessant說對IMAP保持活動是必要的。
我會記住這與發展更新..
服務器最近是否升級?隔離起來,這看起來像是一個有效的IMAP響應字符串的一部分,但也許它看起來超出了上下文,或者可能是'imaplib'中的一個錯誤。您能否獲得IMAP會話的詳細記錄並添加到問題中? – tripleee
嗨@tripleee感謝您的評論。日誌已添加。 –