[NEWBIE]- Syntax error
Steve Holden
sholden at holdenweb.com
Fri Jun 28 10:00:42 EDT 2002
"Alistair Campbell" <campbells4 at ozemail.com.au> wrote in message
news:a7YS8.727$yY2.23825 at ozemail.com.au...
> 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?
>
When you see the ">>>" prompt, the program that's currently reading your
input *is* the Python interpreter.
You should use
python nameofscript.py
at your shell command line prompt. You *can* execute your Python code from
the ">>>" prompt with
import nameofscript
but then I'd have to explain why this works only once, and why thereafter
you'd need to use
reload(nameofscript)
regards
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------
More information about the Python-list
mailing list