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

Python python at bladeshadow.org
Thu Dec 7 20:08:31 EST 2017


On Thu, Dec 07, 2017 at 01:29:11PM +1100, Steve D'Aprano wrote:
> On Thu, 7 Dec 2017 08:22 am, Python wrote:
> >> > 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).

Pedantically speaking, this is only *probably true*, not certainly
true (e.g. running Linux on a text console with something like
midnight commander, some unrelated file manager while running a
particular desktop environment, etc.).  

But more importantly, practically speaking, it still doesn't really
provide much more help to the OP than Lawrence's answer.  He may well
know already that the desktop environment is what does the job (and
probably does even, in broad terms, if he's familiar with computers in
general), but have no idea how to configure it.  A reasonably helpful
answer would be one that mentioned a few of the likely possibilities
(Gnome, KDE, Unity, /etc/mime.types, "other"), and gave hints for how
to find out the answer for each.  A thoroughly helpful answer would
be, well, outside the scope of this list/group.

Pedantry has its place, FWIW. In the computer field, as with other
science and engineering disciplines, often precision is much more
essential than in other fields.  I personally find such precision is
especially warranted if you take it upon yourself to criticize what
someone else has said.  Though, providing such precision via natural
language often turns out to be more challenging than one would hope...




More information about the Python-list mailing list