diff --git a/pyencrypt/loader.py b/pyencrypt/loader.py index 0d87a2c..eeb99f5 100644 --- a/pyencrypt/loader.py +++ b/pyencrypt/loader.py @@ -91,15 +91,11 @@ def find_spec( cls, fullname: str, path: Sequence[_Path], target: types.ModuleType = None ) -> ModuleSpec: if path: + filename = "{}{}".format(fullname.rsplit(".", 1)[-1], ENCRYPT_SUFFIX) if isinstance(path, _NamespacePath): - file_path = ( - Path(path._path[0]) - / f'{fullname.rsplit(".", 1)[-1]}{ENCRYPT_SUFFIX}' - ) + file_path = Path(path._path[0]) / filename else: - file_path = ( - Path(path[0]) / f'{fullname.rsplit(".", 1)[-1]}{ENCRYPT_SUFFIX}' - ) + file_path = Path(path[0]) / filename else: for p in sys.path: file_path = Path(p) / f"{fullname}{ENCRYPT_SUFFIX}"