python Error: IndentationError: expected an indented block

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Nov 8 20:17:15 EST 2006


Please don't post HTML message bodies to a public forum.

Antonios Katsikadamos <antonioskatsikadamos at yahoo.com> writes:

> hi all. I am using python 2.4. I have to run an older python code
> and when i run it i get the following message
> IndentationError: expected an indented block.
> 1)what does this mean?

It's self-explanatory. There's an error in the indentation; Python was
expecting an indented block, but didn't get one.

> 2)how can i overcome this problem

Fix the indentation. As you probably know, in Python, indentation is
syntactically significant information to both the programmer and to
the interpreter. If that information is lost, Python can't know what
was meant, and refuses to guess.

Probably something has mangled the white-space in the program
file. Either fix it manually, or go back to a more canonical form of
the file and see if it's been altered.

-- 
 \      "I have a large seashell collection, which I keep scattered on |
  `\        the beaches all over the world. Maybe you've seen it."  -- |
_o__)                                                    Steven Wright |
Ben Finney




More information about the Python-list mailing list