[issue7262] codecs.open() + eol (windows)

2009-11-04 Thread shamilbi
New submission from shamilbi shami...@gmail.com: different eol when writing to fp = codecs.open(.., 'w', 'cp866') (windows, python-2.6.4) def write(fp): fp.write(\ a ) # eol=0d0a (windows, python-2.6.4) with open('0d0a.tmp', 'w') as fp: write(fp) # eol=0d0a (windows, python-2.6.4

[issue5170] logging to file + encoding

2009-04-22 Thread shamilbi
shamilbi shami...@gmail.com added the comment: Trunk and release26-maint were recently changed (r71657, r71658) to use the following logic, which differs from the code snippet you posted. if (isinstance(msg, unicode) and getattr(stream, 'encoding

[issue5170] logging to file + encoding

2009-04-21 Thread shamilbi
shamilbi shami...@gmail.com added the comment: Can you retry with setting the encoding attribute of the file to cp1251? That should work and that should be the appropriate method to avoid the problem. test_logging.py in the Python distribution has a test which exercises Unicode

[issue5170] logging to file + encoding

2009-04-20 Thread shamilbi
shamilbi shami...@gmail.com added the comment: (python 2.6.2, WinXP) logging to console stopped working. Here is a workaround: logging/__init__.py: class StreamHandler(Handler): ... def emit(self, record): ... if (isinstance(msg, unicode

[issue5170] logging to file + encoding

2009-02-08 Thread shamilbi
shamilbi shami...@gmail.com added the comment: 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'Привет

[issue5170] logging to file + encoding

2009-02-06 Thread shamilbi
New submission from shamilbi shami...@gmail.com: if i configure logging into a file with encoding = 'cp1251' and do logger.debug(u'...') then i get crash with UnicodeError i suggest reimplementing method FileHandler.emit(): ... if isinstance(msg, unicode): stream.write(f % msg