Your bash
script has DOS line endings, but bash
expects Unix-style line endings (just a line-feed, not a carriage-return/line-feed pair. You'll need to remove them; dos2unix
is a good tool to use, as it tr -d '\r'
.
Specifically, it appears the error message comes from
python test.py
since bash
takes the carriage return following the y
in test.py
as part of the file name. The "real" error message consists of the bytes
python: can't open file 'test.py\r': [Errno 2] No such file or directory
but the \r
, when displayed at the terminal, causes the cursor to return to the beginning of the line, so that the rest of the error message starting at ': [Errno 2]...
overwrites the preceding part, producing as you saw
': [Errno 2] No such file or directory