From 999a47f747abed6ca18b1dc6f19d9552c30cf030 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 23 Sep 2023 20:44:00 +1000 Subject: [PATCH] Fix issue with importlib.resources.files() and Python 3.9 --- gns3server/controller/__init__.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 101854c9..4a66fe2d 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -295,7 +295,7 @@ class Controller: if not os.path.exists(os.path.join(dst_path, filename)): shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename)) else: - for entry in importlib_resources.files(f'gns3server.{resource_name}').iterdir(): + for entry in importlib_resources.files('gns3server').joinpath(resource_name).iterdir(): full_path = os.path.join(dst_path, entry.name) if entry.is_file() and not os.path.exists(full_path): log.debug(f'Installing {resource_name} resource file "{entry.name}" to "{full_path}"') diff --git a/requirements.txt b/requirements.txt index 84247047..9f6beade 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ async-timeout>=4.0.2,<4.1 distro>=1.8.0 py-cpuinfo>=9.0.0,<10.0 platformdirs>=2.4.0 -importlib-resources>=1.3; python_version <= '3.9' +importlib-resources>=1.3; python_version < '3.9' truststore>=0.8.0; python_version >= '3.10' setuptools>=60.8.1; python_version >= '3.7' setuptools==59.6.0; python_version < '3.7' # v59.6.0 is the last version to support Python 3.6