使用 imaplib 通过端口 993 连接到 imap.gmail.com 时如何解决套接字错误?
import imaplib
s = imaplib.IMAP4_SSL('imap.gmail.com', 993)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/imaplib.py", line 1138, in __init__
IMAP4.__init__(self, host, port)
File "/usr/lib/python2.6/imaplib.py", line 163, in __init__
self.open(host, port)
File "/usr/lib/python2.6/imaplib.py", line 1149, in open
self.sock = socket.create_connection((host, port))
File "/usr/lib/python2.6/socket.py", line 561, in create_connection
raise error, msg
socket.error: [Errno 113] No route to host
import imaplib
s = imaplib.IMAP4_SSL('imap.gmail.com', 993)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/imaplib.py", line 1138, in __init__
IMAP4.__init__(self, host, port)
File "/usr/lib/python2.6/imaplib.py", line 163, in __init__
self.open(host, port)
File "/usr/lib/python2.6/imaplib.py", line 1149, in open
self.sock = socket.create_connection((host, port))
File "/usr/lib/python2.6/socket.py", line 561, in create_connection
raise error, msg
socket.error: [Errno 113] No route to host
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来像是(可能是暂时的)网络错误而不是软件问题。
现在再试一次,或者从另一台机器上试一次。
Looks like a (possible temporary) network error rather than a software problem.
Try it again now, or from another machine.