I think this indentation is also off - when I open this in my editor this part seems to be unindented?  Could possibly be because there is a mix of spaces and tabs?  Except for the try/except part.