App not working on Mac

Created an app in python to work on Mac, the app works perfectly through terminal but shows error on Launcher. Am new to the mac environment. Please help me resolve this without breaking anything on Mac Ventura 13.5.

I created a python app for Mac(OS version- Ventura 13.5). Version of python used for development - 3.11.
The app was created using Py2app on Mac using the following command. code given below

from setuptools import setup

APP = [‘’]


app = APP,
data_files = DATA_FILES,

-------End of

The app is created to read a text file that outputs another text file. Code is attached.

The app created in the dist folder was moved to the client mac. When the app is double clicked, the launcher shows this error(added below here)
When the app is executed using the command at the terminal, it runs without any issues providing the necessary output.
The user needs the double click to work without the need to use the terminal command every time.

-----Code from

import os
import hl7
from datetime import datetime

TestString = "301(23)12343"

Path = os.path.abspath(os.path.join(os.getcwd(), "../../.."))

Logfilename = "TestLog.txt"
LogOutput = os.path.join(Path, Logfilename)

def writelogfile(datatext):
    with open(LogOutput, "a",encoding='utf8') as ErrorLogfile:
        ErrorLogfile.write(str(datatext) + '\n')    


-----End of Code from




1 Like

Wrap ALL your code in a try block and write any exception that happen with traceback to a log file.
I tend to hard wire to a file in my home folder.
Do not trust that the cwd or environment is what you have in a terminal session.
I write cwd and all the env to the log file when i debug this type of situation as well.

My guess is that you are not in the cwd that you assume.

1 Like

Are you sure that is correct? I ask because what you posted has nothing after the DATA_FILES = and also that code uses smart quotes (the and ) instead of plain quotes (').

1 Like

Try launching the app by running the binary directly from Terminal (e.g. path/to/ That will often give clues about what’s going on.

If I’d have to guess something in h17 is confusing py2app, possibly add a “packages” option (see py2app Setuptools Configuration — py2app 2.0a0 documentation)

1 Like