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

Why I cant open the file simple_app.py

I am getting this error, when I try to open the file.

Marlons-MacBook-Pro:~ marlonmartins$ pyhton simple_app.py

bash: pyhton: command not found

Marlons-MacBook-Pro:~ marlonmartins$


I am using Atom as my text editor, but the simple_app.py location is /Users/marlonmartins/Documents/MarlonMartins/MyDocuments

Does anyone know how to fix this problem ? Thank You guys

4 Answers

Tough to say without more information.

A) Make sure python is installed by typing "python --version" in your console and see if it finds a version. B) If it is installed type "pwd" to find your present working directory. C) From the info that it gives you (which is most likely your home directory), navigate to the directory where your project is located using "cd" followed by the path to your file (ex. cd Documents/MarlonMartins/MyDocuments if your "pwd" stated that you were in Users/marlonmartins to begin with) D) After you are in the MyDocuments directory now you can type the python simple_app.py and it should run.

If all of this seems a bit foreign to you then take the Console Foundations class and it should all make sense. Hope this helped you out. Did my best with the information given. Good luck to you Marlon.

Thanks, Nicholas you helped a lot.

Marlons-MacBook-Pro:MyDocuments marlonmartins$ cd /Users/marlonmartins/Documents/MarlonMartins/MyDocuments Marlons-MacBook-Pro:MyDocuments marlonmartins$ python simple_app.py File "simple_app.py", line 7 return "Hello World" ^ IndentationError: unexpected indent Marlons-MacBook-Pro:MyDocuments marlonmartins$ pyhton models.py -bash: pyhton: command not found

Marlons-MacBook-Pro:MyDocuments marlonmartins$ python models.py Traceback (most recent call last): File "models.py", line 3, in <module> from peewee import * ImportError: No module named peewee Marlons-MacBook-Pro:MyDocuments marlonmartins$

Marlons-MacBook-Pro:MyDocuments marlonmartins$ python simple_app.py File "simple_app.py", line 7

return "Hello World"

^

IndentationError: unexpected indent

why I got this IndentationError: unexpected indent ??

Hi Marlon,

I'm a beginner with Python (and coding in general). But your error when opening the file probably occured because you misspelled "Python". It happened to me more often than I'd like to admit and now whenever I fail to open a file, I first check if I wrote Python correctly (h after the t and not in front).