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 trial

Python

chmod +x diary.py

After doing chmod +x diary.py, I did ./diary.py, I threw me an error ": No such file or directory" Can someone help me with this.

I am using work spaces + windows

2 Answers

Steven Parker
Steven Parker
243,318 Points

Two possible issues come to mind:

  1. you may not have been working in the same folder where the file is located
  2. the file name might be spelled differently (including capitalization - "Diary.py" perhaps?)

If neither of those pan out, we can be more specific if you make a snapshot of your workspace and post the link to it here.

Steven Parker
Steven Parker
243,318 Points

Apparently the file format is not compatible with the command shell. The course may have some other way to deal with this (you didn't link to or mention the course). But here's one way to fix it:

treehouse:~/workspace$ cp diary.py temp
treehouse:~/workspace$ tr -d \\r <temp >diary.py
treehouse:~/workspace$ rm temp

These commands convert the line endings from DOS-style to UNIX-style by removing the carriage returns. Then you can run the file by name. It doesn't do anything interesting yet, but you won't get the error.

Steven Parker Thanks! Do we have any course which covers related unix commands at Treehouse?

Steven Parker
Steven Parker
243,318 Points

The Console Foundations course would cover some basic ones.