Converting Exception to a string in Python 3
问题 does anyone have an idea, why this Python 3.2 code try: raise Exception('X') except Exception as e: print("Error {0}".format(str(e))) works without problem (apart of unicode encoding in windows shell :/), but this try: raise Exception('X') except Exception as e: print("Error {0}".format(str(e, encoding = 'utf-8'))) throws TypeError: coercing to str: need bytes, bytearray or buffer-like object, Exception found ? How to convert an Error to a string with custom encoding? Edit It does not works