]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Improve the PackageLoader error message
authorLily Foote <code@lilyf.org>
Thu, 11 Aug 2022 14:22:08 +0000 (15:22 +0100)
committerDavid Lord <davidism@gmail.com>
Fri, 20 Dec 2024 04:02:32 +0000 (20:02 -0800)
This exception is raised when the `package_path` directory (default "templates") is not
found, so explain this.

src/jinja2/loaders.py

index 35799584cbf4c6ef35b5bd7494eb0c0094c566ae..0cdeca14a4d9e81695c7ffdde7f167d256ea45c0 100644 (file)
@@ -353,8 +353,8 @@ class PackageLoader(BaseLoader):
 
         if template_root is None:
             raise ValueError(
-                f"The {package_name!r} package was not installed in a"
-                " way that PackageLoader understands."
+                f"PackageLoader could not find a '{package_path}' directory for the "
+                f"{package_name!r} package."
             )
 
         self._template_root = template_root