Using py2app with tkinter and openpyxl and multiple files?

雨燕双飞 提交于 2019-12-11 01:09:08

问题


From searching around this is what my setup.py is right now. When I build my application using the -A mode (alias) then try to run it I get this error:

In the console I find this error:

8/21/13 10:09:46.203 PM com.apple.launchd.peruser.501[249]: ([0x0-0x150d50c].org.pythonmac.unspecified.notebook_tracker[24469]) Exited with code: 255

My setup.py code:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup
APP = ['notebook_tracker.app']
DATA_FILES = ['notebook_tracker.pyw']
OPTIONS = {'argv_emulation': True,
            'packages': ['openpyxl','Tkinter']}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    py_modules=['DialogTemplate','reports','customer','schedule','admin','log_data','payment']
)

回答1:


I found the solution to my own problem. openpyxl is a library contained in a .egg file. py2app and py2exe don't play nicely with .egg files. Once I unzipped the .egg file and placed it in my project everything worked nicely. Also my setup.py file didn't need to be nearly as complicated, below is the setup.py that works. Also, I stopped building it in alias mode and it worked just fine.

"""
Script for building the example.

Usage:
    python setup.py py2app
"""

from setuptools import setup

setup(
    app=['notebook_tracker.pyw'],
    setup_requires=["py2app"],
)


来源:https://stackoverflow.com/questions/18364295/using-py2app-with-tkinter-and-openpyxl-and-multiple-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!