当前位置:  开发笔记 > 编程语言 > 正文

Windows上的imapclient错误

如何解决《Windows上的imapclient错误》经验,为你挑选了1个好方法。

我遇到麻烦的环境:Windows10上的Python 2.7.11(修补到目前为止).Python通过msi安装.我在设置中检查了PATH设置,并将其设置为c:\ Python27.

这适用于Mac:

from imapclient import IMAPClient

IMAPClient("imap-mail.outlook.com", use_uid=True, ssl=(True))

但在Windows上,如果barfs像这样:

Traceback (most recent call last):
  File "test_outlook_imap.py", line 3, in 
    IMAPClient("imap-mail.outlook.com", use_uid=True, ssl=(True))
  File "C:\Python27\lib\site-packages\imapclient\imapclient.py", line 152, in     __init__
    self._imap = self._create_IMAP4()
  File "C:\Python27\lib\site-packages\imapclient\imapclient.py", line 164, in _create_IMAP4
    self._timeout)
  File "C:\Python27\lib\site-packages\imapclient\tls.py", line 153, in __init__
    imaplib.IMAP4.__init__(self, host, port)
  File "C:\Python27\lib\imaplib.py", line 173, in __init__
    self.open(host, port)
  File "C:\Python27\lib\site-packages\imapclient\tls.py", line 159, in open
    self.sock = wrap_socket(sock, self.ssl_context, host)
  File "C:\Python27\lib\site-packages\imapclient\tls.py", line 126, in wrap_socket
    ssl_context = create_default_context()
  File "C:\Python27\lib\site-packages\imapclient\tls.py", line 109, in     create_default_context
    context.load_verify_locations(cadata=certs)
  File "C:\Python27\lib\site-packages\backports\ssl\core.py", line 654, in     load_verify_locations
    self._ctx.load_verify_locations(cafile, capath)
  File "C:\Python27\lib\site-packages\OpenSSL\SSL.py", line 528, in load_verify_locations
    _raise_current_error()
  File "C:\Python27\lib\site-packages\OpenSSL\_util.py", line 48, in     exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: []

这与Window对证书链的处理有关吗?

顺便说一句,它对于Outlook域的imap.gmail.com也是如此.



1> Al Sweigart..:

这不是最终答案,但我发现的工作是卸载imapclient并安装旧版本.版本0.13(和0.11)适用于我,但升级到1.0.1后,我收到了您发布的相同错误消息.

要使用pip卸载imapclient,请运行:

pip uninstall imapclient

要使用pip安装旧的0.13版本,请运行:

pip install imapclient==0.13

要验证imapclient的版本,请从交互式shell运行:

>>> import imapclient >>> imapclient.__version__

推荐阅读
放ch养奶牛
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有