info-nowise info-nowise - 3 months ago 10
Python Question

Can't run Python from cmd line

I am a programming (and Python) novice. I am unable to run any python script in command prompt of my WinXP 64-bit laptop. I assigned the path and confirmed it by typing set path. I have Python32.
I get the following message:

>>>python hello.py

File <”stdin”> , Line1
Python hello.py
^
SyntaxError: Invalid syntax


Following is the script I tried:

#!/usr/bin/python
message = "Hello, world!"
print(message)

Answer

You should type this

python hello.py

at the dos/cmd prompt, not inside the Python Interpreter

Comments