diff --git a/xmodule/x_module.py b/xmodule/x_module.py index 30e3b218cc8..00fcc920304 100644 --- a/xmodule/x_module.py +++ b/xmodule/x_module.py @@ -14,7 +14,7 @@ from opaque_keys.edx.asides import AsideDefinitionKeyV2, AsideUsageKeyV2 from opaque_keys.edx.keys import UsageKey from importlib.resources import files, as_file -from pathlib import Path +from pathlib import Path as P from web_fragments.fragment import Fragment from webob import Response from webob.multidict import MultiDict @@ -874,9 +874,9 @@ def get_template_dirpaths(cls): template_dirpaths = [] template_dirname = cls.get_template_dir() package, module_path = __name__.split('.', 1) - module_dir = str(Path(module_path).parent) - file_dirs = files(package).joinpath(module_dir, template_dirname) - + module_dir = str(P(module_path).parent) + module_dir = "" if module_dir == "." else module_dir + file_dirs = files(package).joinpath(module_dir, template_dirname or "") if template_dirname and file_dirs.is_dir(): with as_file(file_dirs) as path: template_dirpaths.append(path)