From 82c7a596ed6b6ce25016541fc088243b2a9d0ebe Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 13 Aug 2021 15:48:49 +0200 Subject: [PATCH] try better stdout --- .../python_console_interpreter/window/widgets.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/openpype/modules/python_console_interpreter/window/widgets.py b/openpype/modules/python_console_interpreter/window/widgets.py index 94dccf019f..20be862d70 100644 --- a/openpype/modules/python_console_interpreter/window/widgets.py +++ b/openpype/modules/python_console_interpreter/window/widgets.py @@ -72,8 +72,18 @@ class PythonInterpreterWidget(QtWidgets.QTextEdit): self.eofKey = None # capture all interactive input/output - sys.stdout = MultipleRedirection(sys.stdout, self) - sys.stderr = MultipleRedirection(sys.stderr, self) + stdout = [] + stderr = [] + if sys.stdout is not None: + stdout.append(sys.stdout) + if sys.stderr is not None: + stderr.append(sys.stderr) + + stdout.append(self) + stderr.append(self) + + sys.stdout = MultipleRedirection(*stdout) + sys.stderr = MultipleRedirection(*stderr) # last line + last incomplete lines self.line = StringObj()