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

holger krekel report at bugs.python.org
Thu Jul 9 21:33:46 CEST 2009


holger krekel <holger.krekel at gmail.com> added the comment:

To recap the use case: stdout is redirected during a test function run
which might trigger arbitrary usage of logging-functionality.  Not
closing the temporary file would mean that there could be as many open
files as there are test functions - or one needs to rely on garbage
collection for closing the resource - this is generally considered bad
practise.  So I consider it best practise to do resource cleanup
immediately and close the temp file.  

Note that the test tool *does not touch the logging module at all*, and
it has no way to mandate the usage of the logging module like you suggest.

----------

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


More information about the Python-bugs-list mailing list