mac:py2app没有找到cacert.pem

时间:2018-03-19 05:06:14

标签: python-requests py2app

我使用py2app创建的应用程序无法找到cacert.pem。下面显示的错误堆栈显示它正在查看应用程序包中的zip文件。我检查了zip文件,cacert.pem似乎在正确的位置。

我已经尝试了建议here的解决方案将cacert.pem复制到请求包中,以便在p2app编译期间找到它,但没有成功。

我在Mac上使用带有python 3.5的Anaconda。

有什么想法吗?

  File "/Users/chuck/Documents/patelco/monitor/dist/monitor.app/Contents/Resources/__boot__.py", line 98, in <module>
    _run()
  File "/Users/chuck/Documents/patelco/monitor/dist/monitor.app/Contents/Resources/__boot__.py", line 82, in _run
    exec(compile(source, path, 'exec'), globals(), globals())
  File "/Users/chuck/Documents/patelco/monitor/dist/monitor.app/Contents/Resources/monitor.py", line 82, in <module>
    send_text_message(report_text)
  File "/Users/chuck/Documents/patelco/monitor/dist/monitor.app/Contents/Resources/monitor.py", line 46, in send_text_message
    message = client.messages.create(to="+1510845xxxx", from_="+1415758xxxx", body=msg)
  File "twilio/rest/api/v2010/account/message/__init__.pyc", line 92, in create
  File "twilio/base/version.pyc", line 205, in create
  File "twilio/base/version.pyc", line 47, in request
  File "twilio/base/domain.pyc", line 46, in request
  File "twilio/rest/__init__.pyc", line 122, in request
  File "twilio/http/http_client.pyc", line 68, in request
  File "requests/sessions.pyc", line 618, in send
  File "requests/adapters.pyc", line 407, in send
  File "requests/adapters.pyc", line 226, in cert_verify
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /Users/chuck/Documents/patelco/monitor/dist/monitor.app/Contents/Resources/lib/python35.zip/certifi/cacert.pem

1 个答案:

答案 0 :(得分:1)

这是requests中的recently fixed错误,但尚未发布到发布版本。如果您可以使用开发版本的请求,则可以从github repo进行安装(如果已经存在则进行升级),以便在构建应用程序时使用此修复程序获得最新版本:

pip install -U https://github.com/requests/requests/zipball/master