0

I try to execute python file through the terminal with ssh (the file itself is not in my computer).

I do the following:

./playg.py

and I get: ": No such file or directory"

I am in the right directory for sure (when I write cat playg.py I can see the content of the file|

The file has the r/w/x properties: -r-xr-xr-x

sara8
  • 199
  • 3
  • 11

6 Answers6

1

First go to playg.py existing folder.

Then type python playg.py

Arshid KV
  • 9,631
  • 3
  • 35
  • 36
1

You can execute it with python playg.py.

The reason you might not be able to execute it with ./playg.py is the first line of the script.

#!/usr/bin/python 

or similar in the first line might not be appropriate for the system.

#!/usr/bin/env python

would look for the python executable in the current environment and is more flexible.

curious_weather
  • 194
  • 1
  • 7
1

check for endline characters encoding. if you have cr-lf encoding instead of lf it gives that error...

0

Go to the directory containing the file and run:

python play.py
0

Please try adding python before the file name while trying to execute

    python playg.py
Strik3r
  • 1,052
  • 8
  • 15
0

python /path/to/file/playg.py should work

Heini
  • 41
  • 7