From 3b8450036abf1861cf20129978e291f0e2baf9a3 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Wed, 21 May 2025 23:22:55 +0000 Subject: [PATCH] core: don't reconfigure stdout if it's fake (#5020) --- Utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utils.py b/Utils.py index f4752448e2..b38809ba1b 100644 --- a/Utils.py +++ b/Utils.py @@ -540,7 +540,8 @@ def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, if add_timestamp: stream_handler.setFormatter(formatter) root_logger.addHandler(stream_handler) - sys.stdout.reconfigure(encoding="utf-8", errors="replace") + if hasattr(sys.stdout, "reconfigure"): + sys.stdout.reconfigure(encoding="utf-8", errors="replace") # Relay unhandled exceptions to logger. if not getattr(sys.excepthook, "_wrapped", False): # skip if already modified