From b5f3aad2b85abf7e3b93f949ca35f37ec6ab58d3 Mon Sep 17 00:00:00 2001 From: Timothy Willard <9395586+TimothyWillard@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:39:40 -0500 Subject: [PATCH] Prefer `FileSystemLoader` over `PackageLoader` --- flepimop/gempyor_pkg/src/gempyor/_jinja.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flepimop/gempyor_pkg/src/gempyor/_jinja.py b/flepimop/gempyor_pkg/src/gempyor/_jinja.py index ce086e76b..bae0e9aae 100644 --- a/flepimop/gempyor_pkg/src/gempyor/_jinja.py +++ b/flepimop/gempyor_pkg/src/gempyor/_jinja.py @@ -10,6 +10,7 @@ # Imports +from os.path import dirname from pathlib import Path from tempfile import mkstemp from typing import Any @@ -19,13 +20,11 @@ # Globals try: - _jinja_environment = Environment(loader=PackageLoader("gempyor")) -except ValueError: - from os.path import dirname - _jinja_environment = Environment( loader=FileSystemLoader(dirname(__file__).replace("\\", "/") + "/templates") ) +except ValueError: + _jinja_environment = Environment(loader=PackageLoader("gempyor")) # Functions