Catch the exception raised in Python 3.2