On 12/11/2019 18:25, Rob Gaddi wrote:
On 11/12/19 10:06 AM, Wildman wrote:
What is the best approach for launching a Python GUI program
on a Linux platform.  The program will be distributed in .deb
format.  So the .deb will contain a menu file as well as a
.desktop file.  The post install script will update the system
menu.

My question is how should the program be executed?  Here are
two choices for the "command=" entry in the menu file...

command="/path/to/program.py"

In this case the hash-bang would have to be included in the
program script... #!/usr/bin/env python3

The other choice is this...

command="python3 /path/to/program.py"

(Of course, the Exec command in the .desktop file should match.)

Is one method better than the other or does it acutally matter?


I will note that without the shebang (and setting the execute bit), the program is only executable from the GUI menu, not the command prompt.  I personally start even GUI programs far more often from a prompt.

To follow Linux conventions you'd put the shebang, make the file executable, and put the executable somewhere on the PATH.  I'd stick to those conventions barring a particular reason not to.

Wildman is talking about launching his program from a menu, so putting it on the PATH is unnecessary. It may even be a bad idea, depending on exactly what he's done :-)

As to the original question, there shouldn't really be much of a difference. The original idea of the shebang line invoking env, as far I recall, was that you'd get the "proper" system python3 wherever it had been put rather than something random and possibly malicious. I guess that means to go for your first option.

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to