[issue6333] logging: ValueError: I/O operation on closed file

Sridhar Ratnakumar report at bugs.python.org
Thu Jul 9 21:56:33 CEST 2009


Sridhar Ratnakumar <sridharr at activestate.com> added the comment:

On Thu, 09 Jul 2009 06:48:28 -0700, Vinay Sajip <report at bugs.python.org>  
wrote:

> It should be understood that if a stream is passed to a StreamHandler,
> the ownership of that stream is passed as well, so closing the handler
> rather than the underlying stream is the right thing to do. ISTM this is
> good practice in general and not exclusive to logging.

However, sys.stdout|err can be assigned to some thing else (eg: py.test  
assigning it to an open file object) .. in which case it is legitimate to  
handle (close) such objects (handles) by who created it (py.test).

----------

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


More information about the Python-bugs-list mailing list