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 trialAlexander 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
Treehouse Moderator 68,441 Pointscheck 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
8,275 PointsHey 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
1,982 PointsHi 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
8,275 PointsHey 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
Asma Al-Marrikhi
45,525 PointsYou 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
James J. McCombie
Python Web Development Techdegree Graduate 21,199 PointsJames J. McCombie
Python Web Development Techdegree Graduate 21,199 Pointsif you are in the directory containing the file, try 'python Diary.py'?