Python Using Databases in Python Our Diary App Switching It Up

Alexander Bilton
Alexander Bilton
1,982 Points

"No such file or directory"

When I enter ./Diary.py I get the following message: "No such file or directory"

I can't attach a picture here unfortunately?...

Chris Freeman
Chris Freeman
Treehouse Moderator 56,833 Points

check the name matches exactly: should it be lowercased daisy.py? Also be sure the file is saved (no dot on file tab indicating changed but not saved.)

Jesse Kroon
Jesse Kroon
8,275 Points

Hey Alexander,

I had the same issue when doing this exercise. After doing some research, I found a few things that helped me out. In the workspace console, before running the diary.py file, use the following two commands:

sed '-i 's/\r//g' diary2.py chmod +x diary2.py

For some reason the workspace console doesn't always give people the 'permission' to run the files. Those two commands, in that order, should solve the problem. At least, they did for me.

Good luck!

Alexander Bilton
Alexander Bilton
1,982 Points

Hi again,

Thanks for your answers.

James: Running the 'python Diary.py' works (Throws a NameError, but that's because of something in my script) Chris: I both checked for casing as well as file saving... Jesse: You mean first run " sed '-i 's/\r//g' diary2.py " and then " chmod +x diary2.py " in the console?

Jesse Kroon
Jesse Kroon
8,275 Points

Hey Alexander,

That's correct! That trick worked for me. I am not completely sure what those two commands do, but I believe they set up the diary.py file for you to have full access and permission to use the file for this exercise.

Hope it will work for you as well!

1 Answer

You should have this code in the top of the file :

#!/usr/bin/env python3

Then write this code on the console:

chmod +x  diary.py