Reputation: 1
I created an app using Py2App for Mac. The app works fine through the terminal, but not through the double click. So now I am trying to use PyInstaller after reading some of the questions here.
I am using a shared cloud MacOS with Sonoma 14.3.
Installation:
Install python3.11
JupyterLab/VS Code/Text editor - I am using Sublime on Mac
Pip3 install hl7
$ pip3 install -U py2app
Setup:
Create a python file with required code for the project. (Eg: TestLaunch09.py)
Create a new file setup.py in the folder where the TestLaunch09.py resides. In the setup.py enter the following and save the file:
from setuptools import setup
APP = ['TestLaunch09.py']
DATA_FILES = []
OPTIONS = {
}
setup(
app = APP,
data_files = DATA_FILES,
options={'py2app':OPTIONS},
setup_requires=['py2app','hl7'],
)
$ python setup.py py2app
This successfully creates a new dist folder.
Inside the dist there is an icon for App with the name ‘TestLaunch09’. The app can be executed at the terminal, but clicking on the icon does not work. This command executes the app through the terminal:
$ TestLaunch09.app/Contents/MacOS/TestLaunch09
But double-clicking shows the following error in a pop-up window:
Launch error
See the py2app website for debugging launch issues
I have tried the following, without success:
Is there an issue with Py2App? I am expecting the double click of the app to work.
Upvotes: 0
Views: 306
Reputation: 41119
py2app
and pyinstaller
are separate tools that are mutually exclusive. You can create an app bundles using pyinstaller alone. If you want to use PyInstaller, remove py2app
from your project first.
By default, PyInstaller will simply create an executable file (for example, a CLI application you can call from your terminal). To create an app bundle that can be launched as a normal MacOS app, pass the --windowed
argument.
pyinstaller --onedir --windowed myscript.py
See Building macOS App Bundles for more information.
Upvotes: 0