Why did I get No such file or directory when trying to run ./diary.py?
I am working in the site Workspaces. I see that my question includes the place in which I am working and where I was last trying to do something. So, I added the !# at the top of diary.py, I added +x permission. Then I tried to run ./diary.py and got an error saying that No such File or directory. Bruce
Chris FreemanTreehouse Moderator 58,944 Points
Hi Bruce, You've added a "bang-she" (!#), instead of a shebang (#!). How I remember is an exclamation point is sometimes called a "bang" so a shebang should end in a bang!. also add the full shebang
I am having the same error.
Here is my console:
treehouse:~/workspace$ chmod +x diary.py treehouse:~/workspace$ ./diary.py : No such file or directory treehouse:~/workspace$ ls diary.db diary.py students.db students.py treehouse:~/workspace$
Here is a copy of my code at top:
#!/usr/bin/env python3 from peewee import * import datetime db = SqliteDatabase('diary.db')
Kenneth LoveTreehouse Guest Teacher
Hmm, I wonder if something has changed in how Peewee or
sqlite3 finds the database file?
Try giving an explicit path:
db = SqliteDatabase('./diary.db')
If that doesn't work, we can find the path with
os.path but let's leave that for later.
Gabbie Metheny33,678 Points
If you run the code in the video and get "No such file or directory":
treehouse:~/workspace$ chmod +x diary.py treehouse:~/workspace$ ./diary.py : No such file or directory
Try running the following line, then the two lines from above again:
sed -i 's/\r//g' diary.py