Launching a Script on the Linux Platform

Rob Gaddi rgaddi at highlandtechnology.invalid
Tue Nov 12 13:25:57 EST 2019


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.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.


More information about the Python-list mailing list