[NEWBIE]- Syntax error

Thomas Guettler zopestoller at thomas-guettler.de
Fri Jun 28 08:18:13 EDT 2002


Alistair Campbell wrote:

> Hi,
> I imagine the answer to this post is very simple ... but I'm not proud.
> 
> Using Python2.2 on Windows OS
> 
> Anyway, when I try to run a script fom the command line in IDLE or Python
> 
> 
>>>>python name_of_script.py
>>>>
> 
> the interpreter complains that there is a syntax error and highlights the
> "name_of _script" part.
> 
> I imagine that I have not initialised some PATH variable or other. I guess
> that i need to put something in the autoexec.bat. Can anyone suggest what?


One solution would be that you start a MS-DOS prompt and start the script
from there. (Python.exe must be in your %PATH%)

But better:
the extension .py should be connected to the interpreter. Double-click
on your script from the windows-explorer should work. The window closes
after the script is run. This will help:

import sys

#.. your code

print "end. Press return"
sys.stdin.readline()


 thomas


BTW:
  python foo.py
does not work since you are in the python interpreter. "python" and "foo.py"
are no known functions.

print "foo" will work







More information about the Python-list mailing list