Environment that I'm having trouble on: Python 2.7.11 on Windows10 (patched up to date). Python installed via a msi. I've checked PATH settings in settings, and it's set to c:Python27.
This works on Mac:
from imapclient import IMAPClient
IMAPClient("imap-mail.outlook.com", use_uid=True, ssl=(True))
But on Windows, if barfs like so:
Traceback (most recent call last):
File "test_outlook_imap.py", line 3, in <module>
IMAPClient("imap-mail.outlook.com", use_uid=True, ssl=(True))
File "C:Python27libsite-packagesimapclientimapclient.py", line 152, in __init__
self._imap = self._create_IMAP4()
File "C:Python27libsite-packagesimapclientimapclient.py", line 164, in _create_IMAP4
self._timeout)
File "C:Python27libsite-packagesimapclientls.py", line 153, in __init__
imaplib.IMAP4.__init__(self, host, port)
File "C:Python27libimaplib.py", line 173, in __init__
self.open(host, port)
File "C:Python27libsite-packagesimapclientls.py", line 159, in open
self.sock = wrap_socket(sock, self.ssl_context, host)
File "C:Python27libsite-packagesimapclientls.py", line 126, in wrap_socket
ssl_context = create_default_context()
File "C:Python27libsite-packagesimapclientls.py", line 109, in create_default_context
context.load_verify_locations(cadata=certs)
File "C:Python27libsite-packagesackportssslcore.py", line 654, in load_verify_locations
self._ctx.load_verify_locations(cafile, capath)
File "C:Python27libsite-packagesOpenSSLSSL.py", line 528, in load_verify_locations
_raise_current_error()
File "C:Python27libsite-packagesOpenSSL\_util.py", line 48, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: []
Is this to do with Window's handling of certificate chains?
Incidentally, it does the same for imap.gmail.com in the place of the Outlook domain.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…