Fix catch to work on Python 3.