problem with program - debugging leading nowhere

John Machin sjmachin at lexicon.net
Fri Jan 30 19:14:58 EST 2009


On Jan 31, 10:43 am, Matthew Sacks <ntw... at gmail.com> wrote:
> i am trying to figure out what has gone wrong in my python program. it
> is complaining that there is an indendation error. should be simple
> enough but im stuck on this one. if anyone can help unjolt me it would
> be appreciated.
>
> thank you
>
> error message:
> Traceback (most recent call last):
>   File "<string>", line 1, in <string>
> IndentationError: expected an indented block (<string>, line 39)
>
> code:http://pastebin.com/f2f971f91

How are you running that? All that <string> stuff is not very
informative. I put your source into a pastebin.py:

>>> import pastebin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pastebin.py", line 31
    elif o is not "":
       ^
IndentationError: expected an indented block

Dunno how you managed line 39.

What you have there is:
        for o, a in optlist:
            if o == "-h":
                #usage()
            elif o is not "":
which is equivalent to:
        for o, a in optlist:
            if o == "-h":
            elif o is not "":
which is not such a good idea.

BTW, why aren't you using optparse?

HTH,
John



More information about the Python-list mailing list