python-capturer icon indicating copy to clipboard operation
python-capturer copied to clipboard

io.UnsupportedOperation when executing inside PyCharm

Open CharlesB2 opened this issue 5 years ago • 0 comments

If capturer is run inside the PyCharm IDE environment, the following error occurs:

Error
Traceback (most recent call last):
  File "/Users/charles3/prog/opu/python/test/test_logging.py", line 27, in test_log_debug
    with CaptureOutput() as capturer:
  File "/Users/charles3/prog/venvs/vopu/lib/python3.5/site-packages/capturer/__init__.py", line 233, in __init__
    self.stdout_stream = self.initialize_stream(sys.stdout, STDOUT_FD)
  File "/Users/charles3/prog/venvs/vopu/lib/python3.5/site-packages/capturer/__init__.py", line 267, in initialize_stream
    real_fd = file_obj.fileno()
io.UnsupportedOperation: fileno

Version 3.0, with PyCharm 2020.1, and Python 3.5

I used instead py.io.StdCaptureFD, and it worked without error

CharlesB2 avatar Jun 18 '20 20:06 CharlesB2