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.
Also, I tried pressing Alt-F2 and it brings up something like Windows' Win-R, but when I enter python3 hello.py it doesn't bring up a terminal window to display any print() output.
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.
from How can I run a Python script from Ubuntu Dash?
No comments:
Post a Comment