I'm having an issue where when I transfer a Python file to my VPS via FTP and try to run it using
./foo.py I am returned with the error:
: No such file or directory.
The error seems to indicate that the file I am trying to execute does not exist. But I can run the program with no problems using
python foo.py which leads me to believe that the error actually probably means something else.
At first I thought it could be an issue with the shebang line, so I copied all of the content of the file and pasted it into a new file on the VPS that had not been transferred via FTP. The two files had exactly the same content but when I ran the new file using
./bar.py it ran as expected.
So I've come to the conclusion that this could be an issue with the way that it is transferred. I have switched between ASCII and binary but both of these transfer methods give the same error.
Is it possible to stop this from happening?