I'm trying to run Python scripts with a shebang on Ubuntu. When I create a python script
#! /usr/bin/env python
import sys
… and run it I get a shell error:
root@host:/home/user# ./test.py
: No such file or directory
How can I make it work?
Solution: Remove '\r's from line endings with dos2unix.
Best Answer
I assume the script is executable? Also, check for carriage returns -- maybe windows got its dirty little hands on it? You can check this with 'cat -vE test.py' and look for '\r'.