Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,989 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.