Why this compile error?

Ulrich Eckhardt eckhardt at satorlaser.com
Fri Mar 19 06:11:18 EDT 2010


Jimbo wrote:
> Can you help me figure out why I am getting this compile error with my
> program. The error occurs right at the bottom of my code & I have
> commented where it occurs.
[...]
> def main():
>     programEnd = False;
> 
>     while (programEnd == False):
>         #ERROR HERE?? - Error="Expected an indented block"
> main()[/CODE]

Was the comment there before or not? In any case, I believe a comment
doesn't qualify as indented block, if you want to leave the block empty
use 'pass' instead. Also, make sure you don't mix tabs and spaces, which is
also a popular way to confuse Python.

BTW: "while" doesn't need brackets, that's a C-ism. ;)

Cheers!

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list