[issue6333] logging: ValueError: I/O operation on closed file
holger krekel
report at bugs.python.org
Thu Jul 9 12:47:46 CEST 2009
holger krekel <holger.krekel at gmail.com> added the comment:
I think the issue is unrelated to py.test - it just presents a use case
as it wants to run 1000's of tests and capture stdout/stderr per each
test function, cannot guess about a test's logging-usage yet wants to
minimize memory/resource usage and close any temporary files it opens.
Anyway, a standalone minimal example involving the issue is this:
import logging
import StringIO
stream = StringIO.StringIO()
logging.basicConfig(stream=stream)
stream.close() # to free memory/release resources
At exit logging's shutdown() will try to flush/close resulting in an
exception. Is it a problem to have the logging module be a bit more
defensive and only try a flush/close if the stream isn't already closed?
----------
nosy: +hpk
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6333>
_______________________________________
More information about the Python-bugs-list
mailing list