Ask Your Question
0

set default application to a terminal command?

asked 2018-12-10 14:32:05 -0500

Hi, I have a .py file I am trying to open. I can open it with the terminal with python main.py, but I want to set python (filename) as the default for .py files. Is there a way to do this? I'm running fedora workstation 29, btw.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-12-10 18:36:46 -0500

fcomida gravatar image

Use a shebang

Put #!/usr/bin/env python3 at the beginning of your python script and make it executable: chmod +x main.py You can now run it this way:

$ ./main.py

or just:

$ main.py

if it's in your PATH

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-12-10 14:32:05 -0500

Seen: 56 times

Last updated: Dec 10 '18