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

2009-11-04 Thread shamilbi
New submission from shamilbi : 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', '

[issue5170] logging to file + encoding

2009-04-22 Thread shamilbi
shamilbi 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

[issue5170] logging to file + encoding

2009-04-21 Thread shamilbi
shamilbi 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 w

[issue5170] logging to file + encoding

2009-04-20 Thread shamilbi
shamilbi 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) or getattr(stream

[issue5170] logging to file + encoding

2009-02-08 Thread shamilbi
shamilbi 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

[issue5170] logging to file + encoding

2009-02-06 Thread shamilbi
New submission from shamilbi : 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