0

I have installed python 2.7 in H:\Py and the google-python-exercises is in H:\Py too

when I opened Python2.7 IDLE(python GUI),and typed !

python Hello.py

then print red word like below

SyntaxError: invalid syntax

so how can I run hello.py?

6
  • So, what is the content of Hello.py then which causes a SyntaxError? Commented Mar 12, 2015 at 15:17
  • the "Hello" becomes red, Commented Mar 12, 2015 at 15:19
  • To clarify, do you mean the "Hello" in the command "python Hello.py" becomes red? It sounds like you're typing python Hello.py into a REPL and not a command prompt. What does the start of the line look like? "H:\py>"? ">>>"? Something else? Can you provide a screenshot? Commented Mar 12, 2015 at 15:19
  • Yes, I mean the "Hello" in the command "python Hello.py" becomes red...and the start of the line look like >>......my reputation is not enough to have a screenshot .and what does REPL mean? thanks Commented Mar 12, 2015 at 15:22
  • Please post the code inside Hello.py. You don't need any reputation to do that!! Commented Mar 12, 2015 at 15:25

1 Answer 1

0

IDLE's Read-eval-print-loop (REPL) window can't execute programs that way. You need a command prompt.

If you are in Windows, hold shift and right click on the folder that contains your project. Select "Open command window here". Enter python Hello.py into that window.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.