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
Sun Dec 10 04:00:06 EST 2017
On Sunday, December 10, 2017 at 11:15:15 AM UTC+5:30, Frank Millman wrote:
> "Rustom Mody" wrote in message
>
>
> <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>
>
>
> I had a similar experience a few years ago, but the recipient was not a
> student, but a bank's IT department!
>
> I had to send them an encrypted document, and their spec specified PGP. I
> used GPG instead, which produces exactly the same result, but with a .gpg
> file extension.
>
> I was told that my file did not work. After much time trying to figure out
> what was wrong, I spoke to one of their staff over the phone, and asked him
> to right-click on the file, select 'rename', and change '.gpg' to '.pgp'. He
> did so, tried again, and said 'Ah, now it works'.
Inspired by this thread, I added
alias o="xdg-open"
to my ~/.bash_aliases
And as best as I can see, now
$ o foo.png
$ o bar.mp3
$ o baz.pdf
and
$ o http://python.org
all do the “Right Thing”
My main attraction for this is that I often end up doing evince foo.png instead of eog foo.png
The one thing that does not work (yet) is
$ o foo.py
starts up gedit (instead of emacs)
PS. As it happens I had figured out something for my students some years ago:
https://bitbucket.org/rustom/vit-projects/wiki/emacsasdefault
I’ll have to reread and recheckout what I wrote back then 😉
More information about the Python-list
mailing list