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

I can not run my "ml.py" file via terminal on Mac

What's wrong with my command line in the terminal (Mac), the error message:

"bash: /Users/olzhas/Downloads/ML-machine-learning-basics/: is a directory (MachineLearningBasics) bash-3.2$ python ml.py python: can't open file 'ml.py': [Errno 2] No such file or directory (MachineLearningBasics) bash-3.2$ "

As you can see I do everything as it is instructed in the lesson but the outcome is negative. I did a search on Google but nothing helped.

where were you running the command from, and what exactly did you type?

3 Answers

Try using the cd command to enter the 'Users/olzhas/Downloads/ML-machine-learning-basics/' directory. You're current working directory is Users/olzhas as show by the fact that ls displays 'Dowloads' so try running:

cd Downloads/ML-machine-learning-basics
ls #This should include the file you want to run in the list
python ml.py

Thanx, It works! I did mistake on folder path and did not use "#" mark, but is not used on lesson. Just have checked it out.

Cooper, I appreciate your help.

I run command from Mac OS;

I typed path to the folder "Users/olzhas/Downloads/ML-machine-learning-basics/" which was instructed to create. Terminal answered "is a directory (MachineLearningBasics) bash-3.2$"

when I typed "ls", terminal send the error message.

Then I tried this way "python ml.py", so the answer was "python: can't open file 'ml.py': [Errno 2] No such file or directory (MachineLearningBasics) bash-3.2$ "

Btw when I type "ls" in terminal it gives me answer like that:

"Algoritms 1.graphml Documents Music AndroidStudioProjects Downloads Pictures Applications Library Projects Desktop Movies Public"