[Tutor] newbie question

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 29 May 2001 19:17:19 -0700 (PDT)


On Wed, 30 May 2001, Brett Shand wrote:

> I'm back to programming after 20 years, and now starting to learn 
> python, using pythonwin in w2k.
> 
> i'm reading 'learning python' - lutz and ascher, mar 99 and run into a 
> problem.
> 
> 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
> >>>
> ---------------------------------------------------

What they meant by

    c:\modules> python spam.py -i eggs -o bacon

is that when you're on the DOS command prompt, you'll see something that
looks like:

    c:\modules>

At this point, we should not in Python yet.  What we can do is call Python
on that spam.py program:

    c:\modules> python spam.py -i eggs -o bacon

and then it should run ok.


PythonWin should have a menu command to execute a script; this might be
easier to use than going to the Command Prompt.


> there is also a caret ^ appears below the colon in line 3 above.

The caret directs our attention to where exactly things looks weird to
Python.  In this case, the whole line looks weird to Python.  *grin*


Hope this helps!