Please tell me how to execute python file in Ubuntu by double click

alister alister.ware at ntlworld.com
Sat Dec 9 06:49:04 EST 2017


On Wed, 06 Dec 2017 10:35:58 +1200, Steve D'Aprano wrote:

> On Tue, 5 Dec 2017 07:58 pm, Lawrence Dâ ÖOliveiro wrote:
> 
>> On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote:
>>>
>>> Sounds like your OS file associations are all botched-up ...
>>
>> Linux doesnâ Öt do â £OS file associationsâ Ø.
> 
> 
> Then how does my Linux box know that when I double-click on a text file,
> it launches kwrite rather than (say) the Gimp or LibreOffice?
> 
> When I right-click on a mp4 video, I get a menu that includes a Open
> With command that shows (amount others) Kaffeine, mplayer and VLC.
> 
> If you mean the Linux *kernel* doesn't do file associations, then you
> should have said so.
> 
> But why do you care about the kernel? Would you think it even the
> *tiniest* useful to claim that "Linux doesn't do email" because it is
> sendmail or postfix
>  (or similar) that sends email rather than the Linux kernel itself?

Linux does not associate by file extn it uses a 'magic' file to analyse 
the content of the file so that it runs the correct application 
regardless of the file extn.

to get a python program to run it simply needs the correct "Shebang" ass 
the 1st line

Usually 

#!/usr/bin/env python
 
or similar




-- 
Some say the world will end in fire,
Some say in ice.
>From what I've tasted of desire
I hold with those who favor fire.
But if it had to perish twice,
I think I know enough of hate
To say that for destruction, ice
Is also great
And would suffice.
		-- Robert Frost, "Fire and Ice"



More information about the Python-list mailing list