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)))
In Python 3, you are already in "unicode space" and don't need encoding. Depending on what you want to achieve, you should the conversion do immediately before doing stuff.
E.g. you can convert all this to bytes(), but rather in the direction
bytes()
bytes("Error {0}".format(str(e)), encoding='utf-8')
.