Crash when launching python

Barry Scott barry at barrys-emacs.org
Wed Sep 4 15:48:21 EDT 2024


> On 4 Sep 2024, at 16:27, Guenther Sohler via Python-list <python-list at python.org> wrote:
> 
> Is it possible to turn on debugging and  to display on the console, where
> python is loading files from ?
> 

I assume you have a .app that is then packaged into a .dmg.

It will be the .app that you need to either build with a debug version of your code
or after building the .app edit the debug code into it.

Do you know that .app files are a tree of files?
You can right-click on an .app in Finder and it will have a "Show Package Context" option.

Or using the terminal and you can:
    cd <appname>.app/Contents

then have a look around.

Beware that you cannot use print to stdout for a .app as its stdin/stdout do not go anywhere useful.
What I do is use code like this in the main function:

sys.stdout = open( '/home/barry/debug.log', 'w', 1 )
sys.stderr = sys.stdout 

Now you can use print(); look in the debug.log to see what happened.
Also any tracebacks will end up in the debug.log.

Barry



More information about the Python-list mailing list