Skip to content

Improve invalid template config errors#2286

Open
Vinayak1337 wants to merge 3 commits into
jupyter:mainfrom
Vinayak1337:improve-template-conf-json-error
Open

Improve invalid template config errors#2286
Vinayak1337 wants to merge 3 commits into
jupyter:mainfrom
Vinayak1337:improve-template-conf-json-error

Conversation

@Vinayak1337

Copy link
Copy Markdown

Summary

  • add a shared loader for template conf.json files
  • report the template configuration file path when JSON parsing fails
  • add a regression test for invalid template config JSON

Why

When a template conf.json is invalid, json.load() raises a JSONDecodeError without showing which template file caused the failure. That is hard to diagnose when multiple template paths are configured.

Fixes #2149.

Testing

  • .venv/bin/python -m pytest -q tests/exporters/test_templateexporter.py::TestExporter::test_invalid_template_conf_json_error_includes_path
  • .venv/bin/python -m pytest -q tests/exporters/test_templateexporter.py
  • .venv/bin/python -m ruff check --fix --show-fixes nbconvert/exporters/templateexporter.py tests/exporters/test_templateexporter.py
  • .venv/bin/python -m ruff format nbconvert/exporters/templateexporter.py tests/exporters/test_templateexporter.py
  • git diff --check
  • manual smoke test confirming the raised error includes the invalid conf.json path

@Vinayak1337 Vinayak1337 marked this pull request as ready for review May 25, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nbconvert for python 3.9 crashing during the templateexporter.py

1 participant