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 trialnakalkucing
12,964 Points/usr/bin/env: 'python3\r': No such file or directory But I followed Kenneth's code exactly!
I know there are several questions and answers about this already, but i still can't fix my problem. :P
In the video Kenneth types: chmod +x diary.py and ./diary.py
I followed this and received back the following error: /usr/bin/env: 'python3\r': No such file or directory
If anyone can tell me how to run this I would really appreciate it. Thanks in advance! :)
Here's my code:
#!/usr/bin/env python3
import datetime
from peewee import *
db = SqliteDatabase('diary.db')
class Entry(Model):
content = TextField()
timestamp = DateTimeField(default=datetime.datetime.now)
class Meta:
database = db
def initialize():
"""Create the database and the table if they dont exist."""
db.connect()
db.create_tables([Entry], safe=True)
def menu_loop():
"""Show the menu"""
def add_entry():
"""Add an entry."""
def view_entries():
"""View previous entries."""
def delete_entry(entry):
"""Delete an entry."""
if __name__ == '__main__':
initialize()
menu_loop()
Chris Freeman
Treehouse Moderator 68,441 PointsYou're welcome! What was your specify issue?
nakalkucing
12,964 PointsI couldn't get diary.py to run. I was getting this error: /usr/bin/env: 'python3\r': No such file or directory But I followed the steps you gave in the question I linked to. That fixed it! :)
2 Answers
Chris Freeman
Treehouse Moderator 68,441 Pointsnakalkucing, Thanks for the mention.
For other travelers, help was found in this post
Phu Tran
Python Web Development Techdegree Student 4,687 PointsHi, could you post the full code? I tried to edit the code in 30 minutes and still get "No such file or directory"
nakalkucing
12,964 PointsHi Phu Tran! The above code is the full code. In the next video Kenneth does change this code, so if that's the code you want, let me know.
If you're still getting the "No such file or directory" error, try typing this into the console: python3 diary.py
This was suggested in this discussion by Kenneth.
nakalkucing
12,964 Pointsnakalkucing
12,964 PointsProblem solved. Found the answer here. Thanks Chris Freeman!