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 trialkevin nadjarian
1,498 PointsPython : SyntaxError: invalid syntax
Whatever I do, I receive a Python error:
python hello.py
SyntaxError: invalid syntax
>>> python hello.py
File "<stdin>", line 1
python hello.py
^
SyntaxError: invalid syntax
Tried to change the script from the courses or even from external template, always have the same issue
3 Answers
behar
10,799 PointsLooks like your problem is that you are trying to run python hello.py from within the Python interpreter, which is why you're seeing that traceback.
Make sure you're out of the interpreter, then run the python hello.py command from bash or command prompt or whatever.
kevin nadjarian
1,498 PointsYes ... that was it !
Thank you !
qemdmrvpii
2,469 PointsI'm getting the same error and I don't understand what to do
Jeffrey Vierra
25,404 PointsHi Mitchel,
I was getting the same error. I found a resolution by upgrading my Python 2.3 to version 3. I'm using a Mac terminal to test out all my Python code. A simple google search "how to upgrade python 2.7 to three" should be a good place to start for you.
Good luck.