I am using Python 2.7.9. x32 on Win7 x64.
When I register an Exception containing Umlauts, I always get UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 39: ordinal not in range(128)
My sample code is:
except Exception as e: logging.error('Error loading SCMTool for repository ' '%s (ID %d): %s' % (repo.name, repo.id, e), exc_info=1)
WindowsError: [Error 267] Der Verzeichnisname ist ungültig logged exception WindowsError: [Error 267] Der Verzeichnisname ist ungültig . The problem is based on "ung Ü ltig" umlaut.
After deleting the last %s and e it works without problems.
This happens every time an exception is logged, so changing each registrar is not an alternative.
Does anyone have an idea how to make Exception return a unicode string globally?
Seega source share