这个问题是由 paul_h 提出的,但我太新了,无法评论(希望)相关信息。我在使用 imapClient 时遇到了同样的问题,而且它显然不是特定于 Python/Windows 版本的。Paul H 在 win 10 上运行 Python 2.7.11。Windows 上的imapclient 错误
我运行的是 3.4.3,甚至升级到了 3.5.1。在win7上,甚至尝试过旧的Vista机器。
import imapclient
imapObj = imapclient.IMAPClient('imap.gmail.com', ssl=True)
它返回:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
imapObj = imapclient.IMAPClient('imap.gmail.com', ssl=True)
File "C:\Python\lib\site-packages\imapclient\imapclient.py", line 152, in __init__
self._imap = self._create_IMAP4()
File "C:\Python\lib\site-packages\imapclient\imapclient.py", line 164, in _create_IMAP4
self._timeout)
File "C:\Python\lib\site-packages\imapclient\tls.py", line 153, in __init__
imaplib.IMAP4.__init__(self, host, port)
File "C:\Python\lib\imaplib.py", line 189, in __init__
self.open(host, port)
File "C:\Python\lib\site-packages\imapclient\tls.py", line 159, in open
self.sock = wrap_socket(sock, self.ssl_context, host)
File "C:\Python\lib\site-packages\imapclient\tls.py", line 126, in wrap_socket
ssl_context = create_default_context()
File "C:\Python\lib\site-packages\imapclient\tls.py", line 109, in create_default_context
context.load_verify_locations(cadata=certs)
File "C:\Python\lib\site-packages\backports\ssl\core.py", line 654, in load_verify_locations
self._ctx.load_verify_locations(cafile, capath)
File "C:\Python\lib\site-packages\OpenSSL\SSL.py", line 528, in load_verify_locations
_raise_current_error()
File "C:\Python\lib\site-packages\OpenSSL\_util.py", line 48, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: []
同时,库存 imaplib 与 ssl 连接良好。
M = imaplib.IMAP4_SSL('imap.gmail.com')
很抱歉提出一个新问题,但我不想将其发布为答案。