diff --git a/setup.py b/setup.py index ca24e8aa..4b4cd02b 100644 --- a/setup.py +++ b/setup.py @@ -7355,7 +7355,7 @@ def dsv41_engine_env(lib_dirs) -> dict: def dsv41_pack_info(exe: Path, pack: Path, lib_dirs) -> tuple[bool, str]: """`strata-dsv41 --pack-info --pack P`: (True, text) when every file of the pack is there (no MISSING line), else (False, text).""" try: - r = subprocess.run([str(exe), "--pack-info", "--pack", str(pack)], capture_output=True, text=True, timeout=300, + r = subprocess.run([str(exe), "--pack-info", "--pack", str(pack)], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=300, env=dsv41_engine_env(lib_dirs)) except (OSError, subprocess.TimeoutExpired) as e: return False, f"the engine could not read the pack: {e}" @@ -7370,7 +7370,8 @@ def dsv41_smoke(exe: Path, pack: Path, lib_dirs, gpus=None, timeout: int = 5400) if gpus: cmd += ["--gpus", ",".join(str(g) for g in gpus)] try: - r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout, env=dsv41_engine_env(lib_dirs)) + r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=timeout, + env=dsv41_engine_env(lib_dirs)) except (OSError, subprocess.TimeoutExpired) as e: return False, f"the test run did not finish: {e}" text = ((r.stdout or "") + (r.stderr or "")).strip() diff --git a/tools/dsv41/smoke.py b/tools/dsv41/smoke.py index d39a3f9f..3a3e1956 100644 --- a/tools/dsv41/smoke.py +++ b/tools/dsv41/smoke.py @@ -59,6 +59,11 @@ def sensible(text: str) -> tuple[bool, str]: def main() -> int: + for st in (sys.stdout, sys.stderr): # the reply has DeepSeek's special tokens (fullwidth bars): a Windows console code page cannot print them + try: + st.reconfigure(encoding="utf-8", errors="replace") + except (AttributeError, OSError): + pass ap = argparse.ArgumentParser() ap.add_argument("--exe", required=True) ap.add_argument("--pack", required=True) @@ -77,7 +82,7 @@ def main() -> int: if a.gpus: cmd += ["--gpus", a.gpus] try: - r = subprocess.run(cmd, capture_output=True, text=True, timeout=a.timeout, env=dict(os.environ)) + r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=a.timeout, env=dict(os.environ)) except (OSError, subprocess.TimeoutExpired) as e: print(f"the engine did not finish the test run: {e}") return 2