Python Using Databases in Python Our Diary App Doing Data Entry

Pat McCarthy
Pat McCarthy
9,800 Points

chmod +x diary.py ./diary.py

When I use this command, I get the following error: chmod +x diary.py
./diary.py

./diary.py: line 1: $'\r': command not found
./diary.py: line 3: $'\r': command not found
./diary.py: line 4: import: command not found
./diary.py: line 5: $'\r': command not found
./diary.py: line 6: from: command not found
./diary.py: line 7: $'\r': command not found
./diary.py: line 8: syntax error near unexpected token (' '/diary.py: line 8:db = SqliteDatabase('diary.db')

Could anyone help me fix this?

2 Answers

Logan R
Logan R
22,823 Points

Did you make sure to add "#!/usr/bin/env python3" as the first line in your script?

Pat McCarthy
Pat McCarthy
9,800 Points

Yes I put the shebang in the .py file and saved it.