Python Using Databases in Python Our Diary App Doing Data Entry

Make python executable with /usr/bin/env python3

I get an error message of ": No such file or directory" when I run ./diary.py. I did do the chmod +x diary.py. When I did 'ls', my diary.py was green in text instead of the usual black. Can someone please help me get rid of the error message? Thanks!

2 Answers

Steven Parker
Steven Parker
172,034 Points

:point_right: The default file format is not compatible with the shell command.

Something seems to have changed, I don't recall this happening before. But now the editor apparently creates files in the "DOS" format, using CR and LF characters at the end of each line.

But the BASH shell expects any script file to be in native Linux format, with line ends having LF only.

You can convert your file like this:

tr -d \\r <diary.py >tempfile && mv tempfile diary.py

Once converted, the editor seems to recognize the format and add new lines the same way.