From 74488ac2f4544813b62ae97f8e9eedfd4b42a56f Mon Sep 17 00:00:00 2001 From: Mostafa Razavi Date: Thu, 6 Jun 2024 20:38:57 +0200 Subject: [PATCH] Fix error message for non-existing directory --- CHANGES.rst | 2 ++ src/jinja2/loaders.py | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7fb729763..66c07db6d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,8 @@ Unreleased ``Template.generate_async``. :pr:`1960` - Avoid leaving async generators unclosed in blocks, includes and extends. :pr:`1960` +- Fix misleading error message when template does not exist. + :pr:`1995` Version 3.1.4 diff --git a/src/jinja2/loaders.py b/src/jinja2/loaders.py index 8c2c86cd0..ed3ef1600 100644 --- a/src/jinja2/loaders.py +++ b/src/jinja2/loaders.py @@ -347,10 +347,7 @@ def __init__( break if template_root is None: - raise ValueError( - f"The {package_name!r} package was not installed in a" - " way that PackageLoader understands." - ) + raise ValueError("Template directory was not found.") self._template_root = template_root