I have a Python terminal application, that I call from a .desktop file, something like this:
[Desktop Entry] Version=1.0 Name=My App Exec=python3 /home/pi/my_app.py Terminal=true Type=Application Categories=Application;
And it does what I want: when I double-click the desktop shortcut, terminal starts up, application runs, when it is done, the terminal is shut down too.
However, recently I started getting some errors/exceptions which force the Python application to shut down - and as this also shuts down the terminal, I cannot read the error messages.
So I tried something like this:
[Desktop Entry] Version=1.0 Name=My App Exec=python3 /home/pi/my_app.py ; read -p "press" Terminal=true Type=Application Categories=Application;
... however, since it is directly in the Exec argument, and there is no explicit call to
read .. part is interpreted as command line arguments to the Python program, and now the program crashes instantly, shutting down the terminal (but at least it was easier to repeat this, and realize that the error message is from Python about command line arguments).
Note that I would prefer not to add a call to
bash in the .desktop file, since I've noticed, when I run this app directly from a terminal, I cannot get the error reproduced (apparently the error somehow shows up only when I run it from double-clicking the .desktop file).
So, what else can I do, to run this application via the .desktop shortcut in a terminal, and have it not close the terminal window when the application exits, so I can read the error messages?