From 6e439785c683102df72dc5531618efc5199af0bc Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Mon, 24 Aug 2026 00:32:17 +0200 Subject: [PATCH] fix: pass PYTHONIOENCODING to the job subprocess too The stdio reconfigure only covers the API process. main.py prints an emoji on its first line and configures nothing, so on a cp1252 console the server now starts but every job dies before rendering. --- app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.py b/app.py index 03b5803..fd33bb1 100644 --- a/app.py +++ b/app.py @@ -1693,6 +1693,11 @@ async def process_endpoint( cmd = [sys.executable, "-u", "main.py"] # -u for unbuffered env = os.environ.copy() env["GEMINI_API_KEY"] = api_key # Override with key from request + # The stdio fix above only covers this process. main.py prints an emoji on + # its first line and configures nothing, so on a cp1252 console the child + # still dies before it renders anything -- the server starts and every job + # fails instead. setdefault, so an explicit PYTHONIOENCODING still wins. + env.setdefault("PYTHONIOENCODING", "utf-8") # Optional layouts are per job. The renderer reads these at import time in # the subprocess, so they must be set before Popen — same path WATERMARK