From 9cd898bc9f87f30f4eabba11957785022dfd418a Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Mon, 4 May 2026 15:50:52 +0000 Subject: [PATCH] fix: route parent-directory creation through the JSON write try/except Was leaking unhandled OSError tracebacks when the output's parent path could not be created. Exit code stays 1; user-facing message matches the existing write-failure path. Co-Authored-By: Claude Opus 4.7 (1M context) --- tools/pz-analyzer/pz_classify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pz-analyzer/pz_classify.py b/tools/pz-analyzer/pz_classify.py index 7bdb560..d8e17c1 100644 --- a/tools/pz-analyzer/pz_classify.py +++ b/tools/pz-analyzer/pz_classify.py @@ -247,9 +247,9 @@ def _run(input_dir: Path, out_path: Path, *, quiet: bool) -> int: "summary": _build_summary(merged), } - out_path.parent.mkdir(parents=True, exist_ok=True) tmp = out_path.with_suffix(out_path.suffix + ".tmp") try: + out_path.parent.mkdir(parents=True, exist_ok=True) with tmp.open("w", encoding="utf-8") as f: json.dump(document, f, ensure_ascii=False, indent=2) f.write("\n")