Re: syntax error : first python program

2009-12-23 Thread Ben Finney
Anssi Saari writes: > At least here with Python 2.5.2 I get "IndentationError: unexpected > indent". I'm just wondering why would the OP get a SyntaxError? $ python2.4 -c ' pass' File "", line 1 pass ^ SyntaxError: invalid syntax $ python2.5 -c ' pass' File "", line 1 pass ^

Re: syntax error : first python program

2009-12-23 Thread Anssi Saari
Ben Finney writes: >> bash# /usr/bin/python sample.py >> File "sample.py", line 2 >> name = "blah" >> ^ >> SyntaxError: invalid syntax > > Indentation is syntax in Python. At least here with Python 2.5.2 I get "IndentationError: unexpected indent". I'm just wondering why would the OP g

Re: syntax error : first python program

2009-12-23 Thread Bearophile
Ben Finney: > > bash# /usr/bin/python sample.py > >   File "sample.py", line 2 > >     name = "blah" > >     ^ > > SyntaxError: invalid syntax > > Indentation is syntax in Python. But I agree, a little better error message may help there, something that contains "indentation" in it :-) Bye, bear

Re: syntax error : first python program

2009-12-22 Thread Ben Finney
pradeep writes: > #!/usr/bin/env python > name = "blah" > print name These two lines are indented, but are not inside a block. > bash# /usr/bin/python sample.py > File "sample.py", line 2 > name = "blah" > ^ > SyntaxError: invalid syntax Indentation is syntax in Python. > An

Re: syntax error : first python program

2009-12-22 Thread Erik Max Francis
pradeep wrote: I have this file in linux === sample.py #!/usr/bin/env python name = "blah" print name ... Any one knows , whats the syntax error here? You're indenting for no reason. -- Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/ San Jos

syntax error : first python program

2009-12-22 Thread pradeep
I have this file in linux === sample.py #!/usr/bin/env python name = "blah" print name --- I executed this bash# ./sample.py File "./sample.py", line 2 name = "blah" ^ bash# /usr/bin/python sample.py File "sample.py", line