This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author shamilbi
Recipients shamilbi, vinay.sajip
Date 2009-02-08.13:36:19
SpamBayes Score 1.0183713e-06
Marked as misclassified No
Message-id <1234100183.8.0.366907728495.issue5170@psf.upfronthosting.co.za>
In-reply-to
Content
test_log.py:
-----------
#! -*- coding: windows-1251 -*-

import logging

logger = logging.getLogger('test_log')
logger.addHandler(logging.FileHandler('test.log', encoding='cp1251'))
logger.setLevel(logging.DEBUG)

logger.debug(u'Привет')    # russian Hello

exception:
---------
Traceback (most recent call last):
  File "e:\bin\python\0\lib\logging\__init__.py", line 765, in emit
    self.stream.write(fs % msg.encode("UTF-8"))
  File "e:\bin\python\0\lib\codecs.py", line 686, in write
    return self.writer.write(data)
  File "e:\bin\python\0\lib\codecs.py", line 351, in write
    data, consumed = self.encode(object, self.errors)
  File "e:\bin\python\0\lib\encodings\cp1251.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_table)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0:
ordinal not in range(128)
History
Date User Action Args
2009-02-08 13:36:24shamilbisetrecipients: + shamilbi, vinay.sajip
2009-02-08 13:36:23shamilbisetmessageid: <1234100183.8.0.366907728495.issue5170@psf.upfronthosting.co.za>
2009-02-08 13:36:22shamilbilinkissue5170 messages
2009-02-08 13:36:21shamilbicreate