From d02ffe49ff195a80d0db3231149bfba670b8c3e5 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 5 Apr 2024 11:58:40 +0200 Subject: [PATCH] Fix resource loader --- map2map/main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/map2map/main.py b/map2map/main.py index 7b65930..a31643c 100644 --- a/map2map/main.py +++ b/map2map/main.py @@ -14,9 +14,9 @@ from functools import partial def _load_resource_file(resource_path): # Import the package - pkg_files = importlib.resources.files() - with pkg_files.open(resource_path) as file: - return file.read_text() # Read the file and return its content + pkg_files = importlib.resources.files() / resource_path + with pkg_files.open() as file: + return file.read() # Read the file and return its content def _str_list(value): return value.split(',') @@ -86,8 +86,7 @@ def _apply_options(options_file, f): return f -def m2m_options(f): - return _apply_options("common_args.yaml", f) +m2m_options=partial(_apply_options,"common_args.yaml") @click.group()