aliyun / aliyun-oss-python-sdk

Aliyun OSS SDK for Python
MIT License
939 stars 363 forks source link

PyInstaller 打包后运行错误 #377

Closed guoguo163 closed 9 months ago

guoguo163 commented 9 months ago

45 INFO: PyInstaller: 3.4 45 INFO: Python: 2.7.5 45 INFO: Platform: Linux-3.10.0-862.el7.x86_64-x86_64-with-centos-7.5.1804-Core oss2 版本 '2.18.4'

py脚本运行没有问题,但是通过PyInstaller -F 打包后运行出错,在之前的2.3.4 没有遇到问题

File "UploadOss.py", line 28, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/__init__.py", line 15, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/resumable.py", line 19, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/crypto_bucket.py", line 10, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/crypto.py", line 21, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "aliyunsdkcore/client.py", line 45, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "aliyunsdkcore/retry/retry_policy.py", line 33, in <module> File "aliyunsdkcore/retry/retry_condition.py", line 219, in __init__ File "aliyunsdkcore/utils/__init__.py", line 23, in _load_json_from_data_dir IOError: [Errno 2] No such file or directory: '/tmp/_MEIRrgxgc/aliyunsdkcore/data/retry_config.json' [2304] Failed to execute script UploadOss

guoguo163 commented 9 months ago

已解决

45 信息:PyInstaller:3.4 45 信息:Python:2.7.5 45 信息:平台:Linux-3.10.0-862.el7.x86_64-x86_64-with-centos-7.5.1804-Core oss2 版本“2.18.4”

py脚本运行没有问题,但是通过PyInstaller -F备份后运行出错,在之前的2.3.4没有遇到问题

File "UploadOss.py", line 28, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/__init__.py", line 15, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/resumable.py", line 19, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/crypto_bucket.py", line 10, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "oss2/crypto.py", line 21, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "aliyunsdkcore/client.py", line 45, in <module> File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module exec(bytecode, module.__dict__) File "aliyunsdkcore/retry/retry_policy.py", line 33, in <module> File "aliyunsdkcore/retry/retry_condition.py", line 219, in __init__ File "aliyunsdkcore/utils/__init__.py", line 23, in _load_json_from_data_dir IOError: [Errno 2] No such file or directory: '/tmp/_MEIRrgxgc/aliyunsdkcore/data/retry_config.json' [2304] Failed to execute script UploadOss

已解决,在spec文件的Analysis里面把目录包含进去。 datas=[('/usr/lib/python2.7/site-packages/aliyunsdkcore/data/','aliyunsdkcore/data/')],

guoguo163 commented 9 months ago

已解决,并不是oss2的问题,是最新版的aliyunsdkcore会有这个问题