trouble with built app in Macos

32 views
Skip to first unread message

Ushuyaya Geppeto

unread,
Apr 2, 2022, 4:11:52 AM4/2/22
to PyInstaller
Hi,
I'm facing a strange behaviour: my app built with pyinstaller doesn't open when double-clicking on it while it works perfectly when opening it from a console using 'open app.app' and when opening the content of the app and directly launching the unix executable.
Previous app with minor differences built using previous script version one month and half ago worked out of the box. So, two things have changed since: updating my pip packages (including numpy, scipy, pyqt5) and a small part of the script (some Qtext more).

Do you have some clues to help me finding the point? I suppose it is a Mac trouble as the unix executable is working fine, and also the app when launched from a console.

Thanks for your incoming help

bwoodsend

unread,
Apr 2, 2022, 11:26:57 AM4/2/22
to PyInstaller

I believe that the main difference between running an application from macOS’s terminal and via clicking on it is that clicking on it runs the application in a very bare environment with almost no environment variables so that your application can’t find the home directory or the current encoding/locale and any application which it is supposed to find in $PATH will be invisible to it. I’m afraid the best I can offer for debugging is to wrap your code in something like the block below then inspect /tmp/error-message.txt to see what the problem really is.

import traceback

try:
    # Your code here.
except BaseException as ex:
     with open("/tmp/error-message.txt", "w") as f:
         traceback.print_exc(file=f)
     raise

If you find that that file never gets written, it’s probably macOS’s gatekeeper blocking your application from running.

Reply all
Reply to author
Forward
0 new messages