使用imaplib通过端口993连接到imap.gmail.com时如何解决套接字错误?

时间:2011-04-15 03:15:55

标签: imaplib

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

1 个答案:

答案 0 :(得分:0)

看起来像(可能是临时的)网络错误而不是软件问题。

现在再试一次,或从另一台机器再试一次。