Hello!
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.
setup.py code given below
-------setup.py----------
from setuptools import setup
APP = [‘Process.py’]
DATA_FILES =
OPTIONS = {
}
setup(
app = APP,
data_files = DATA_FILES,
options={‘py2app’:OPTIONS},
setup_requires=[‘py2app’],
)
-------End of setup.py----------
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 Process.py--------
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')
ErrorLogfile.close()
writelogfile(Path)
print(Path)
-----End of Code from Process.py--------
Thanks
Kripa