Karthikeyan Singaravelan <[email protected]> added the comment:
A little simplified reproducer :
import io, contextlib, logging
message = 'dummy test'
with io.StringIO() as sio:
with contextlib.redirect_stdout(sio), contextlib.redirect_stderr(sio):
logging.warning(message)
output = sio.getvalue()
print(output)
logging.warning(message)
$ python3.7 /tmp/foo.py
WARNING:root:dummy test
--- Logging error ---
Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
line 1036, in emit
stream.write(msg)
ValueError: I/O operation on closed file
Call stack:
File "/tmp/foo.py", line 11, in <module>
logging.warning(message)
Message: 'dummy test'
Arguments: ()
----------
nosy: +xtreak
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36193>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com