"""Keep hosted Space logs UTF-8 even when the base image advertises a charmap.""" import sys for _stream in (sys.stdout, sys.stderr): if hasattr(_stream, "reconfigure"): _stream.reconfigure(encoding="utf-8", errors="replace")