我有一个Python脚本,它应该将服务器列表写入Excel文件。当它作为Python脚本运行时,它可以工作。当我在py2app的别名模式下运行它时,它也可以工作。
然而,当我构建一个可再发行的单文件Mac应用程序(在these instructions之后)时,一切正常 - 除了编写服务器的名称而不是写一个数字。
到底发生了什么事?
输出错误:
脚本的工作原理:
在使用" python setup.py py2app"后,我在终端中看到以下内容:命令:
Modules not found (unconditional imports):
* ElementC14N (xml.etree.ElementTree)
* PIL (easygui.boxes.utils)
* PIL.ImageTk (openpyxl.drawing.image)
* __builtin__.open (repr)
* __main__.__requires__ (pdb)
* _imp (pkg_resources)
* _weakref.CallableProxyType (_weakrefset)
* _weakref.ProxyType (_weakrefset)
* _weakref.ReferenceType (_weakrefset)
* _weakref.getweakrefcount (_weakrefset)
* _weakref.getweakrefs (_weakrefset)
* _weakref.proxy (_weakrefset)
* _winreg.CloseKey (urllib)
* _winreg.HKEY_LOCAL_MACHINE (urllib)
* _winreg.OpenKeyEx (urllib)
* _winreg.QueryValueEx (urllib)
* errno.EINVAL (os)
* errno.ENOENT (os)
* java.System (java.lang)
* nt._getfullpathname (os)
* nt._isdir (os)
* org (copy, org.python.core)
* org.PyStringMap (org.python)
* org.python (copy, pickle)
* org.python.core (pickle)
* org.python.core.PyStringMap (copy)
* packaging (pkg_resources)
* packaging.specifiers (pkg_resources)
* pwd.getpwnam (distutils.util)
* sys.exc_info (os)
* sys.getwindowsversion (os)
* sys.modules (os)
* sys.py3kwarning (os)
* tests (openpyxl.reader.excel)
* thread._local (collections)
* thread.allocate_lock (collections)
* thread.stack_size (collections) [scroll down for more]
* tkinter (easygui.boxes.utils)
* tkinter.filedialog (easygui.boxes.utils)
Modules not found (conditional imports):
* Image (openpyxl.drawing.image)
* PIL (openpyxl.drawing.image)
* _md5 (hashlib)
* _sha (hashlib)
* _sha256 (hashlib)
* _sha512 (hashlib)
* importlib.machinery (pkg_resources)
* java (platform)
* java.lang (platform)
* riscospath (os)
* urllib.parse (pkg_resources)
设置文件如下所示:
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['CheckEmailServers2.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
我的系统和软件: