Apologies if this is posted in the wrong forum.
I have written some simple code which runs fine. It compiles cleanly using py2app and a setup.py file but the resulting app does not run (even in a console). It crashes immediately with’Launch Error’ and no further details.
I suspect I have missed a dependency. Can you help?
Many thanks!
Technical details:
late 2013 iMac running 12.6.3
Python 3.8
Here is the python code:
This program lets you choose an audio file to transribe and writes it to the console
import openai
from tkinter.filedialog import askopenfilename
import os
new_directory = ‘/Users/justinbaron/Desktop/Recordings’
os.chdir(new_directory)
api_key = ‘my_key’
chosen_file = askopenfilename()
chosen_file = askopenfilename()
openai.api_key = api_key
audio_file= open(chosen_file, “rb”)
transcript = openai.Audio.transcribe(“whisper-1”, audio_file)
print(transcript.text)
Here is the setup.py file:
APP = [‘Simple AI.py’]
DATA_FILES =
OPTIONS = {
‘argv_emulation’: True,
‘packages’: [‘openai’, ‘pydub’, ‘tkinter’, ‘os’],
‘includes’:[‘ffmpeg’,‘numpy’]
}
setup(
app=APP,
data_files=DATA_FILES,
options={‘py2app’: OPTIONS},
setup_requires=[‘py2app’],
install_requires=[
]
)