Python Python Basics Types and Branching If, Else and Elif

kevin nadjarian
kevin nadjarian
1,498 Points

Python : 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

Looks 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
kevin nadjarian
1,498 Points

Yes ... that was it !

Thank you !

Mitchell Wakefield
Mitchell Wakefield
2,469 Points

I'm getting the same error and I don't understand what to do