[Tutor] python Error: IndentationError: expected an indented block.

Kent Johnson kent37 at tds.net
Wed Nov 8 16:03:56 CET 2006


Antonios Katsikadamos wrote:
> 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?
> 2)how can i overcome this problem

Python uses indentation to delimit blocks, for example an if statement 
will be followed by an indented block:

if a < b:
   print 'a is less than b'

One way you can get this error is if you mix tabs and spaces for the 
indent character. Common usage is to use four spaces for an indent. 
Check that your code is consistent in its use of tabs or spaces.

It's also possible that you are just missing a character or two.

Posting actual code and the full error message including the traceback 
might help, though whitespace problems might be hidden in email.

Kent

> 
> 
> Thanks for any advice.
> 
> kind regards,
> 
> Antonios
> 
> ------------------------------------------------------------------------
> Sponsored Link
> 
> Free Uniden 5.8GHz Phone System with Packet8 Internet Phone Service 
> <http://www.getpacket8.net/yahoo2>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor




More information about the Tutor mailing list