added executable and fixed except clauses to use the Python 3 syntax