Stirling-Tools/Stirling-PDF · error · SystemExit
Input directory not found: {input_dir}
Error message
Input directory not found: {input_dir} What it means
summarize_type3_signatures.py reads captured Type3 signature JSON dumps from a directory (default docs/type3/signatures) and writes a Markdown inventory. It checks input_dir.exists() at line 86 and exits with this message if the path is missing before globbing. The path comes from --input and is resolved relative to the current working directory. A missing directory almost always means signatures have not been captured yet or the script was invoked from the wrong cwd.
Source
Thrown at scripts/summarize_type3_signatures.py:87
lines.append("| --- | --- | --- | --- |")
for entry in entries:
signature = entry.get("signature") or "—"
sample = Path(entry["source"]).name
glyph_count = entry.get("glyphCount") if entry.get("glyphCount") is not None else "—"
coverage = entry.get("glyphCoverage") or []
preview = ", ".join(str(code) for code in coverage[:10])
lines.append(f"| `{signature}` | `{sample}` | {glyph_count} | {preview} |")
lines.append("")
output.parent.mkdir(parents=True, exist_ok=True)
output.write_text("\n".join(lines), encoding="utf-8")
def main() -> None:
args = parse_args()
input_dir = Path(args.input)
if not input_dir.exists():
raise SystemExit(f"Input directory not found: {input_dir}")
inventory = load_signatures(input_dir)
output_path = Path(args.output)
write_markdown(inventory, output_path, input_dir)
print(f"Wrote inventory for {len(inventory)} aliases to {output_path}")
if __name__ == "__main__":
main()
View on GitHub (pinned to 9ef20dcab8)
Solutions
- Confirm the directory exists: `ls <input_dir>`
- Run the upstream signature-capture step first so the directory is populated with *.json dumps
- Pass an absolute path with `--input /abs/path` to remove cwd ambiguity
Example fix
# before -- run before capturing anything python scripts/summarize_type3_signatures.py --input docs/type3/signatures # (fails: directory does not exist) # after -- populate first, then summarize from repo root python scripts/extract_type3_signatures.py docs/sample.pdf --out docs/type3/signatures python scripts/summarize_type3_signatures.py --input docs/type3/signatures
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
input_dir = Path(args.input)
if not input_dir.is_dir():
raise SystemExit(f"Input directory not found: {input_dir}") Prevention
- Run the script from the repo root so the relative default path resolves
- Populate the directory via the signature-capture step before summarizing
- Pass an absolute --input path in CI to avoid cwd sensitivity
When it happens
Trigger: Running the script before any Type3 signature extraction has populated docs/type3/signatures; passing a --input path that is misspelled or relative to a different cwd; the directory was cleaned or is gitignored and never created.
Common situations: Fresh checkout where signature capture hasn't run; invoking from a subdirectory so the relative default path doesn't resolve; CI running on a minimal checkout that excludes docs/.
Related errors
- File not found: {json_path}
- No PDF files found under the supplied --input paths.
- Failed to save file
- Unexpected JSON structure (expected an object at root).
- No URLs supplied. Use --urls and/or --urls-file.
AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13).
Data as JSON: /api/errors/1fca46f3e5b659ac.
Report an issue: GitHub.