Some python 3 fixes on exceptions.