newbie question

Emile van Sebille emile at fenx.com
Wed Oct 31 12:13:02 EST 2001


" 1" <jnlc at bellsouth.net> wrote in message
news:yXVD7.6251$QL2.175221 at e3500-atl1.usenetserver.com...
> ok to keep it simple.
> I am running win98se w/ python 2.1 installed. I have tried this in both
> python shell and in command line.
>
> Just to keep it simple I wrote a file called "hello.py". all that it
> contains is a print command (print" hello world!"). I saved the command in
> the python dir in my PC and named it "hello.py".
>
> When I got to run the file (by typing python hello.py)i get this error
> message:
>
> >>> python hello.py
> SyntaxError: invalid syntax
> >>>
>
> Is there anything that i missed or did wrong. This is just a simple little
> example of a bigger problem.

You've got a syntax error in the file, probably extra spaces

C:\>echo print "Hello World!" > test.py
C:\>type test.py
print "Hello World!"
C:\>python test.py
Hello World!

Here's a wrong example:
# there's an extra space before print
C:\>echo  print "Hello World!" > test.py

C:\>python test.py
  File "test.py", line 1
    print "Hello World!"
    ^
SyntaxError: invalid syntax


Note how the '^' points at the problem.  You should get something similar.

HTH,

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list