Tweak how exception messages are printed on Python 3 to match Python 2