我编写了一个程序,当我从python解释器运行它没有任何错误时工作正常,然后我使用py2exe将其转换为.exe但是当我运行它时它不再工作了......我得到了这个错误:
Traceback (most recent call last):
File "pass.py", line 1, in <module>
File "dropbox\__init__.pyc", line 3, in <module>
File "dropbox\client.pyc", line 22, in <module>
File "dropbox\rest.pyc", line 26, in <module>
File "pkg_resources.pyc", line 950, in resource_filename
File "pkg_resources.pyc", line 1638, in get_resource_filename
NotImplementedError: resource_filename() only supported for .egg, not .zip
当我下载导入程序的模块时,我应该在使用py2exe时做些什么吗? 这些是导入的模块:
import dropbox
import os
import getpass
from time import sleep
请帮忙!
答案 0 :(得分:0)
我使用找到的here
解决方案解决了这个问题基本上你修改了dropbox库中的rest.py中的第26行 对此:
try:
TRUSTED_CERT_FILE = pkg_resources.resource_filename(__name__, 'trusted-certs.crt')
except:
# if current module is frozen, use library.zip path for trusted-certs.crt path
# trusted-certs.crt must exist in same directory as library.zip
if hasattr(sys,'frozen'):
resource_name = sys.prefix
resource_name.strip('/')
resource_name += '/trusted-certs.crt'
TRUSTED_CERT_FILE = resource_name
else:
raise
然后将在dropbox库中找到的trusted-certs.crt文件放在与可执行文件相同的文件夹中