ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
348 stars 35 forks source link

version 0.14 compiles apps that fail to open on MacOS 10.10.5 #236

Open ronaldoussoren opened 6 years ago

ronaldoussoren commented 6 years ago

Original report by Kris Kringle (Bitbucket: kriskringle101, ).


Using py2app 0.14 installed through pip 9.0.1 python 3.6.3 MacOSX 10.10.5

For simplicity sake I am using the tkinter hello world example:

import tkinter from tkinter.constants import *

tk = tkinter.Tk() frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2) frame.pack(fill=BOTH,expand=1) label = tkinter.Label(frame, text="Hello, World") label.pack(fill=X, expand=1) button = tkinter.Button(frame,text="Exit",command=tk.destroy) button.pack(side=BOTTOM) tk.mainloop()

I run py2applet --make-setup hello.py which makes a setup file

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

Usage: python setup.py py2app """

from setuptools import setup

APP = ['hello.py'] DATA_FILES = [] OPTIONS = {}

setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], )

I then run python setup.py py2app -A to develop in Alias mode and it makes the build and dist folders.

Now, no matter how I try to open the application (double click or via terminal) it fails with a hello Error and gives two options. Open Console or Terminate

Looking at console, there is only one line that pops up from the error.

It reads, hello: hello Error.

That is it. I have tried adding the 'argv_emulation': True to the setup.py OPTIONS No change. I have tried it in deployment mode. No change. Also, whatever I name the program is the name of the error. If I were to name the program test, it would fail with test Error

What am I missing to get this going?

ronaldoussoren commented 6 years ago

Original comment by Josh Stephens (Bitbucket: josh_sperahealth, ).


Hi Kris, I just ran into your issue today while having the same issue and spending 4 hours trying to resolve it. For me the workaround was to downgrade to 0.13. While not Ideal I hope it at least helps you move forward until 0.14 can be fixed

ronaldoussoren commented 6 years ago

Original comment by George B (Bitbucket: george_b, ).


Same issue with my app. I dropped back to a 0.10 fork I found and my app works now. Hopefully 0.15 will fix whatever is causing the issue.

ronaldoussoren commented 6 years ago

Original comment by Hamish McIntyre-Bhatty (Bitbucket: hamishmb, GitHub: hamishmb).


I had this issue before as well, so I reverted back to 0.13 too. Unfortunately, 0.13 doesn't work with python 3.7, so I'm a bit stuffed at the moment

ronaldoussoren commented 5 years ago

Original comment by Dominic Peng (Bitbucket: DominicPeng, GitHub: DominicPeng).


I also have this problem, I tried the latest version and version 0.13 and even the fork one on https://github.com/metachris/py2app, but none of them worked. Hope it can be fixed soon!

ronaldoussoren commented 5 years ago

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


I'll have a look at this next weekend.

ronaldoussoren commented 5 years ago

Original comment by Dominic Peng (Bitbucket: DominicPeng, GitHub: DominicPeng).


Actually I tried it on other small files and they worked well. Then I found out that the problem was I forgot to add the packages imported to the Options in setup.py. But when I tried it on the previous one, another problem popped out: Traceback (most recent call last):

File "setup.py", line 18, in

setup_requires=['py2app'],

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/setuptools/init.py", line 140, in setup

return distutils.core.setup(**attrs)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup

dist.run_commands()

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands

self.run_command(cmd)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command

cmd_obj.run()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 659, in run

self._run()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 865, in _run

self.run_normal()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 939, in run_normal

mf = self.get_modulefinder()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 814, in get_modulefinder

debug=debug,

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/modulegraph/find_modules.py", line 338, in find_modules

find_needed_modules(mf, scripts, includes, packages)

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/modulegraph/find_modules.py", line 256, in find_needed_modules

path = m.packagepath[0]

TypeError: 'NoneType' object is not subscriptable

In setup.py: OPTIONS = {'iconfile':'icon.ico', 'argv_emulation': True, 'packages':['gtts', 'pillow', 'matplotlib', 'pygame', 'numpy', 'scipy']} How can I fix it this time? Sincere appreciation for your help.

ronaldoussoren commented 5 years ago

Original comment by Dominic Peng (Bitbucket: DominicPeng, GitHub: DominicPeng).


Actually I tried it on other small files and they worked well. Then I found out that the problem was I forgot to add the packages imported to the Options in setup.py. But when I tried it on the previous one, another problem popped out: Traceback (most recent call last):

File "setup.py", line 18, in

setup_requires=['py2app'],

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/setuptools/init.py", line 140, in setup

return distutils.core.setup(**attrs)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup

dist.run_commands()

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands

self.run_command(cmd)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command

cmd_obj.run()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 659, in run

self._run()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 865, in _run

self.run_normal()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 939, in run_normal

mf = self.get_modulefinder()

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/py2app/build_app.py", line 814, in get_modulefinder

debug=debug,

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/modulegraph/find_modules.py", line 338, in find_modules

find_needed_modules(mf, scripts, includes, packages)

File "/Users/Dominic/Documents/python/fishc/IPS/venv/lib/python3.6/site-packages/modulegraph/find_modules.py", line 256, in find_needed_modules

path = m.packagepath[0]

TypeError: 'NoneType' object is not subscriptable In setup.py: OPTIONS = {'iconfile':'icon.ico', 'argv_emulation': True, 'packages':['gtts', 'pillow', 'matplotlib', 'pygame', 'numpy', 'scipy']} How can I fix it this time? Sincere appreciation for your help.

ronaldoussoren commented 5 years ago

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


Adding the "packages" option should not be necessary, but should also not result in the exception you're getting. I'm working on a fix for that in the modulegraph package.

I cannot reproduce the original issue on 10.13 or 10.14, I'll try to debug in a 10.10 VM later this weekend.