On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main() opened the blob unguarded, so a path that does not exist, or any other
file I/O failure, escaped as a FileNotFoundError traceback and exited 1. Every
other tool in tools/ reports a missing input as one ERROR line and exits 2, and
#948 fixed the same thing in world_index.py; this was the last one left.
Read the blob inside a try/except OSError and name the file that failed. Nothing
is written before the input is read.
Test: tests/test_swizzle_search.py runs the CLI on a missing path and asserts
exit 2, the ERROR line naming it, and no traceback.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>