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 Zhang
4,312 PointsMake python executable with /usr/bin/env python3
I get an error message of ": No such file or directory" when I run ./diary.py. I did do the chmod +x diary.py. When I did 'ls', my diary.py was green in text instead of the usual black. Can someone please help me get rid of the error message? Thanks!
2 Answers
Steven Parker
231,269 PointsThe default file format is not compatible with the shell command.
Something seems to have changed, I don't recall this happening before. But now the editor apparently creates files in the "DOS" format, using CR and LF characters at the end of each line.
But the BASH shell expects any script file to be in native Linux format, with line ends having LF only.
You can convert your file like this:
tr -d \\r <diary.py >tempfile && mv tempfile diary.py
Once converted, the editor seems to recognize the format and add new lines the same way.