我尝试在python中使用imaplib连接到主机' imap.gmail.com'。
import imaplib
M = imaplib.IMAP4_SSL('imap.gmail.com')
但它没有回应。我尝试使用pdb来查看问题。它转到IMAP4_SSL的init函数并挂起(主机,端口)。 这是键盘中断的追溯:
File "/usr/lib/python2.7/imaplib.py", line 1148, in __init__
IMAP4.__init__(self, host, port)
File "/usr/lib/python2.7/imaplib.py", line 163, in __init__
self.open(host, port)
File "/usr/lib/python2.7/imaplib.py", line 1159, in open
self.sock = socket.create_connection((host, port))
File "/usr/lib/python2.7/socket.py", line 562, in create_connection
sock.connect(sa)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
对此有任何帮助将不胜感激。