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

Rustom Mody rustompmody at gmail.com
Sat Dec 9 23:42:11 EST 2017


On Friday, December 8, 2017 at 6:40:17 AM UTC+5:30, Python wrote:
> 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...

<anecdote>
I was sending some files to some students. 
Since it was more than one, the natural choice was a tarball.
[I believe that since it was a very tiny total space I did not compress the 
tarball… but I dont remember this part exactly]
The point is that instead of sending a stuff.tgz or stuff.tar file I sent a file 
called just stuff; ie I must have done:
$ tar xvf stuff directory
rather than the more normal
$ tar xvf stuff.tar directory

I got a return mail soon enough: “Your file is corrupt; it wont open”
(in file-roller or whatever tar-GUI the kids nowadays use)

I could have given them the answer: There are no associations in
Linux. Just
$ mv stuff stuff.tar
and it will work
As it happens I am lazy; easier to believe that my file was "wrongly" named;
did the mv myself, and resent the now "correct" tarball; problem solved.
</anecdote>

Whether there was nothing wrong in what I did, the "wrong-right" was de facto,
or de jure… I will leave to more wise persons than myself



More information about the Python-list mailing list