harden execute_js_rich + fix GBK encoding crash on pyw

This commit is contained in:
Liang Jiaqing
2026-02-13 15:54:52 +08:00
parent 8d3582e3b7
commit 4163341bb3
3 changed files with 26 additions and 19 deletions

View File

@@ -1,6 +1,10 @@
import os, sys
if sys.stdout is None: sys.stdout = open(os.devnull, "w")
if sys.stderr is None: sys.stderr = open(os.devnull, "w")
try: sys.stdout.reconfigure(errors='replace')
except: pass
try: sys.stderr.reconfigure(errors='replace')
except: pass
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import streamlit as st