• pyinstaller打包shotgun有关的程序


    By 鬼猫猫 http://www.cnblogs.com/muyr/

    背景

    使用pyinstaller打包跟shotgun有关的程序后,在自己电脑上运行都OK,但是编译好的exe在其他人的电脑上运行失败(就是连接Shogun那一步出错),错误内容为:

    Traceback (most recent call last):
      File "<string>", line 286, in slotSetting
      File "<string>", line 28, in connectShotgun
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.shotgun", line 307, in __init__
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.shotgun", line 326, in server_caps
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.shotgun", line 353, in info
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.shotgun", line 1418, in _call_rpc
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.shotgun", line 1514, in _make_call
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.shotgun", line 1532, in _http_request
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.lib.httplib2", line 1441, in request
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.lib.httplib2", line 1193, in _request
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.lib.httplib2", line 1128, in _conn_request
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.lib.httplib2", line 895, in connect
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzshotgun_api3.lib.httplib2", line 77, in _ssl_wrap_socket
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzssl", line 381, in wrap_socket
      File "d:mu_refpyinstaller	imelogsuild	imelogsout00-PYZ.pyzssl", line 141, in __init__
    ssl.SSLError: [Errno 185090050] _ssl.c:340: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
    

    分析

    出错原因:https://github.com/kennethreitz/requests/issues/557

    解决方法:http://stackoverflow.com/questions/14486631/pyinstaller-compiled-file-has-ssl-issue-error-185090050

    出错的大概原因是:pyinstaller可能没有将httplib2中的cacert.txt文件打包进来,导致编译完成的exe运行时加载失败。

    解决方法

    在开发过程,不需要修改什么,该怎么弄怎么弄。

    在打包之前,需要修改一点shotgun_api3,比如我的是在C:Python27Libsite-packagesshotgun_api3-3.0.14-py2.7.eggshotgun_api3libhttplib2文件夹里,中的__init__.py第180和181行,将

    CA_CERTS = os.path.join(os.path.dirname(os.path.abspath(__file__)), "cacerts.txt")
    

    改为

    CA_CERTS = os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "cacerts.txt")
    

    然后再执行pyinstaller打包过程,完成之后,将httplib2文件夹里面的cacert.txt拷贝一份到打包好的.exe相同层级即可。

    注意:打包完了,记得将init.py改回来啊,别影响了(其他)项目的开发

    Powered by Sublog

  • 相关阅读:
    [VC++入门]C++中常用的运算符及微软自定义类型
    搜索引擎蜘蛛爬虫原理
    Enterprise Library 5.0
    Installshield 12 中文系列教程之 定义安装必要条件
    installshield脚本
    c# 事物处理
    InStallShield网络资源参考
    Could not execute query against OLE DB provider 'OraOLEDB.Oracle'
    frameset小结
    最痛心的距离
  • 原文地址:https://www.cnblogs.com/muyr/p/3564762.html
Copyright © 2020-2023  润新知