I have some Python files that I wrote on my Windows PC and then sent over to a Linux machine using pscp. They work as intended on Windows, but when I try to execute them on the Linux machine, I always get an error message.
I use the following process to run the code after importing the file "test.py":
First, I add the shebang line at the top of test.py:
#!/usr/bin/python # rest of code
Then I modify permissions and try to run the script:
chmod +x test.py ./test.py
which gives me the error message
./test.py: Command not found.
If I create a file from scratch on the Linux machine and type in the exact same program text, the program will run just fine. Also, if I type the following code, the program runs just fine:
Can anyone explain what is happening here? Thanks.