[BangPypers] IndentationError: expected an indented block

Pradeep Gowda pradeep at btbytes.com
Wed Mar 11 15:26:41 CET 2009


(resending reply to the list.. )

Python uses indentation for blocks
your code has uneven indentation(1 space?) and no indentation in some places.

You have to indent code correctly. Use FOUR spaces for indentation.

eg:
 if len(args) == 0:
 print "Fatal: no indication type provided."
 sys.exit(1)

should read:
 if len(args) == 0:
    print "Fatal: no indication type provided."
    sys.exit(1)

If you are copying this code off a webpage(I say this because I see a
IBM copyright at the top), look for a "raw source" version of the
same, which retains the indentation.

Read : http://www.python.org/dev/peps/pep-0008/

+PG

On Wed, Mar 11, 2009 at 10:19 AM, Sandeep HS <sandeep.hs at greenturtles.in> wrote:
>
>  Hello,
>
>  This is Sandeep H S working in Green Turtles Technologies,  B'lore.
>
>  I am trying to execute a python program but unable to do so .
>
>  Every time i execute that python program , I am getting error as
>  File "ind.py", line 280
>  dom = parseString(xmldata)
>       ^
> IndentationError: expected an indented block
>
>   I am very new to Python.I think that error is occuring due mismatch of
> colon ( : ) or parameter xmldata fails.How to overcome this problem ?
>
>    Here by i am attaching ind_test.py ie python program file.
>
>    Please find the attachment and kindly solve this issue...
>
>    Thanks
>    Sandeep H S
>
>
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>


More information about the BangPypers mailing list