Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment: Your second example (logging_error.py) fails for the same reason - you're writing a byte-string to a stream which is expecting Unicode. The error occurs in logging only it tries encoding as UTF-8 as a last-ditch attempt - and that only happens because of an earlier exception caused by you not writing a Unicode string.
In summary: If you open a stream via codecs.open, whether directly or through the logging module, you are expecting the stream to do encoding for you. Therefore, you only write Unicode to the stream - never a byte-string. If you have a byte-string in your application which you have obtained from somewhere else, convert it to Unicode using whatever encoding applies to the source. Then, send the resulting Unicode to the encoding stream (or logger). ---------- status: open -> pending _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6991> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com