I've written hello.py (a basic "hello world" program) and would like to be able to quickly run it on my Ubuntu machine by pressing the Win key to open Dash, then type the name of the script (or something similar to that).
However, when I type hello.py into Dash, it opens the file in an editor rather than execute it. I added a shebang line #!/usr/bin/env python3
and run chmod u+x hello.py
, it still opens the file in an editor.
I tried creating a hello.sh shell script that will run the Python script, but the shell script also gets opened in the editor when I type its name into Dash.
Is there a way to run a Python script by typing its name into Dash? Or is there another easy way to run an arbitrary Python script? Essentially, what I want is something like the Windows Run Dialog Box that appears when you press Win-R, which can run any program on the system PATH.
python3 hello.py
– Rinzwind Mar 16 '19 at 17:28alt+f2
for that, but I am not sure it will display any output, in case this is what you want. – mikewhatever Mar 16 '19 at 17:41