Repository navigation
sandbox: a --scene the filesystem refuses is one ERROR line and exit 2 (EGEN-SANDBOX-SCENE-OSERROR) - #7760
Conversation
sandbox.py calls sandbox_scene.build() directly, so a --scene that names a folder or sits under a regular file let PermissionError/FileNotFoundError escape main() as a traceback. Catch OSError there and answer exactly as sandbox_scene.main() already does for the same path: one ERROR: line and exit 2. The module docstring now names exit 2 beside 77.
Two cases the traceback used to swallow: --scene names an existing folder, and --scene sits under a regular file. Both assert exit 2, one stderr line, and no traceback, with the tool and shader pair stubbed so no GPU, build or game files are needed.
…till returns 77 The guard must not swallow paths that do work: with one placed row and no exported model the scene file is written, stderr stays empty and main() returns 77 for the unsupported frame, as it did before.
|
Tested 5bb116c on Windows 11 Pro es-ES, CPython 3.14.2, CPU only, no game data: pass. Nit: (AI-assisted check, Claude Code.) |
|
Tested 5bb116c on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
tools/sandbox.pyis the documented entry point (docs/sandbox.md§4), and it callssandbox_scene.build()directly instead of going through that tool'smain(). The only thing it catches isSystemExit, so when the scene cannot be written theOSErrorescapesmain():--scene <existing folder>ends inPermissionError, and--scene <regular file>/scene.bininFileNotFoundError, both as a Python traceback with exit 1.sandbox_scene.pyitself already answers the identical path with oneERROR:line and exit 2 (itsmain(), "an unwritable --out used to end in a traceback"), so the two tools disagree about the same failure and a caller cannot tell a refused path from a crash.This catches
OSErroraround the same call and answers exactly assandbox_scene.main()does: oneERROR:line on stderr, exit 2. The module docstring now lists exit 2 beside the existing 0 and 77. Unreadable inputs (--entities,--models) land in the same guard, sincebuild()opens them.Test
tests/test_sandbox.py(new; no GPU, no build, no game files: the tool and the shader pair are stubbed and the entities file is one hand-written placement row).Before, on the base commit:
After:
The two sibling suites still pass:
python -I tests/test_sandbox_pick.py(6 tests OK) andpython -I tests/test_sandbox_scene.py(11 tests OK).python -m compileall -q tools/sandbox.py tests/test_sandbox.pyandpython -I scripts/check_no_game_data.py tools/sandbox.py tests/test_sandbox.pyare clean.Notes
sandbox_scene.main()(ERROR: {e}, stderr, exit 2) rather than theunsupported:prefix and 77 code: a refused scene path is a bad argument, not a missing package, pair or GPU, and 77 is the value scripts treat as a skip.docs/sandbox.mddoes not list exit codes, so it stays as it is.sandbox.pyforwards tosandbox_scene.build()bypass that tool'sap.errorchecks, so a negative--radiusor--max-propsstill reports "unsupported" with exit 77.EGEN-SANDBOX-SCENE-OSERROR
No GPU needed.
AI-assisted.