IndentationError: unexpected unindent WHY?

you didn't complete your try statement. You need and except in there too.


@MaxPython The answer below is missing syntax ":"

    try:
       #do something
    except:
      # print 'error/exception'


    def printError(e):
        print e

It's because you have:

def readTTable(fname):
    try:

without a matching except block after the try: block. Every try must have at least one matching except.

See the Errors and Exceptions section of the Python tutorial.


This error could actually be in the code preceding where the error is reported. See the For example, if you have a syntax error as below, you'll get the indentation error. The syntax error is actually next to the "except" because it should contain a ":" right after it.

try:
    #do something
except
    print 'error/exception'


def printError(e):
    print e

If you change "except" above to "except:", the error will go away.

Good luck.