Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

Steve D'Aprano steve+python at pearwood.info
Wed Dec 6 21:29:11 EST 2017


On Thu, 7 Dec 2017 08:22 am, Python wrote:

> On Wed, Dec 06, 2017 at 10:35:58AM +1100, 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?
> 
> The answer to that is (sadly) complicated.

Actually, no, the answer to my question is very simple: Lawrence is mistaken
about Linux not doing file associations. It does -- it is merely handled by
the desktop environment (if there is one).

Lawrence is showing off his geek cred with an answer that is pedantically
correct but in practice not just useless but actually false. Of course Linux
computers can associate certain files with certain applications.

If the term "OS file associations" is ever so slightly inaccurate (it's not
the actual OS kernel that does the associating, but the desktop environment),
well, we can probably say the same thing about Mac OS X and maybe even
Windows itself.


> How it knows indeed 
> depends on the context of the click, what desktop environment you're
> using, what application(s) you're using, and what configurations
> you've made to those things to address any file associations.

Indeed you are correct, which is why it may not be a trivial matter to answer
the OP's question about how to get the behaviour he wants. But that isn't
what my comment is about. I'm simply replying to Lawrence's insinuation that
Linux computers don't associate file types to applications.

I'm sure that Lawrence worded his statement *ever so carefully* to ensure that
it was pedantically correct if read to the letter, while still insinuating
something completely wrong. It takes a lot of care to provide information
which is both true and utterly misleading at the same time, but Lawrence does
it very, very well indeed.

If only he would use his considerable intellect to provide *useful* answers
instead of *accurate but misleading* answers.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list