[New-bugs-announce] [issue6333] logging: ValueError: I/O operation on closed file

Sridhar Ratnakumar report at bugs.python.org
Wed Jun 24 03:42:48 CEST 2009


New submission from Sridhar Ratnakumar <sridharr at activestate.com>:

The logging module has a bug that tries to call `flush' on a closed 
file handle (sys.std[out|err] to be specific). This bug was introduced 
by ConsoleHandler as defined in http://code.activestate.com/
recipes/576819/

The fix is simple: change definition of StreamHandler.flush in logging/
__init__.py to:

  def flush(self):
      if self.stream and hasattr(self.stream, 'flush') and not 
self.stream.closed:
          logging.StreamHandler.flush()

----------
components: Library (Lib)
messages: 89653
nosy: srid
severity: normal
status: open
title: logging: ValueError: I/O operation on closed file
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6333>
_______________________________________


More information about the New-bugs-announce mailing list