Catch Python 3 exception