content of the file -

print "Go"

used chmod +x devansh.py to make executable the file


*Error: no such file "Go"*

The file does run but error is always displayed in the output just like above.

closed as unclear what you're asking by mikewhatever, Thomas, Jacob Vlijm, Eric Carvalho, Elder Geek Sep 22 '18 at 20:54

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You need to include the full content of the script, the full command you run it with. Too many open variables to answer the question as it is. – Jacob Vlijm Sep 22 '18 at 10:50

Clearly the file devansh.py lacks a shebang line that indicates how the script should be executed. See Why does Python in Linux require the line #!/usr/bin/python? for an explanation of a shebang line.


Content of devansh.py:

print "Go"

Attempt to execute it:

chmod +x devansh.py
Error: no such file "Go"


Content of devansh.py:

#!/usr/bin/env python

print "Go"

Execute it:

chmod +x devansh.py

Your question contains three different instances of bad Python usage.

  1. You're trying to run print "Go" as a bash command.
  2. It's not necessary to make a separate file to run a one-line Python command.
  3. The unnecessary separate file which you named devansh.py does not need to be made executable with chmod +x devansh.py.

I highlighted these three things in bold text so that you can easily find them.

You got the following error message:

Error: no such file "Go".

...because you're trying to run print "Go" directly from the terminal as a bash command instead of running it as Python 2.x code which is what it is.

To show the correct path to devansh.py drag the devansh.py file into the terminal. Then change directories using cd to the directory containing devansh.py and run the command to make devansh.py executable: chmod +x devansh.py again.

In order for the print "Go" code to execute successfully Python 2.x needs to be installed.

sudo apt install python2.7   

Then execute the devansh.py file by running the following command:

python devansh.py  

devansh.py doesn't need to have executable permissions. python devansh.py will run successfully even if devansh.py is not made executable.

Alternatively you don't need to install python2.7 if you change the print "Go" code to be compatible with Python 3 which is installed by default.


You don't need to have a file named devansh.py to run this code. Just type python to start the python interpreter. When the python interpreter is started the prompt changes to >>>. Then you can run the code directly in the terminal by typing print "Go" after the python prompt.

Not the answer you're looking for? Browse other questions tagged or ask your own question.