[Tutor] newbie question

Doug Stanfield DOUGS@oceanic.com
Tue, 29 May 2001 16:25:04 -1000


[Brett Shand]
> I'm back to programming after 20 years, and now starting to learn 
> python, using pythonwin in w2k.

Wise choice in Python, but you'll find that out in good time...

> i'm reading 'learning python' - lutz and ascher, mar 99 and 
> run into a 
> problem.

Excellent choice of books...

> i've made a module file 'spam.py' and saved it as 
> c:\modules\spam.py - and then run it (see below) as suggested on 
> page 13-14. i get the error below.  What am i doing wroing? 
> 
> -------------------------------------------------
> >>> c:\modules> python spam.py -i eggs -o bacon
> Traceback (  File "<interactive input>", line 1
> c:\modules> python spam.py -i eggs -o bacon
> SntaxError: invalid syntax
> >>>
> ---------------------------------------------------
> 
> there is also a caret ^ appears below the colon in line 3 above.
> 
> any ideas please.

Well, to be more complete in describing what you did, you first opened the
interpreter window in Pythonwin, right.  The '>>>' is the giveaway.  The
line that you then typed in was actually meant to be entered at a Windows
command prompt.  When typed in the interpreter, Python doesn't interpret
them as Python language so its telling you that as soon as it hits a
character that doesn't fit its preconceived ideas. ;-)

HTH

-Doug-