diff --git a/NDATools/Configuration.py b/NDATools/Configuration.py index 752b27a2..927400b1 100644 --- a/NDATools/Configuration.py +++ b/NDATools/Configuration.py @@ -6,7 +6,7 @@ import time import yaml -from pkg_resources import resource_filename +from importlib.resources import files import NDATools from NDATools import NDA_TOOLS_LOGGING_YML_FILE @@ -135,7 +135,7 @@ def _is_vtcmd(self): def _check_and_fix_missing_options(self): default_config = configparser.ConfigParser() - default_file_path = resource_filename(__name__, 'clientscripts/config/settings.cfg') + default_file_path = files(__name__) / 'clientscripts/config/settings.cfg' default_config.read(default_file_path) change_detected = False for section in default_config.sections(): diff --git a/NDATools/__init__.py b/NDATools/__init__.py index bd7c2f01..d445d21c 100644 --- a/NDATools/__init__.py +++ b/NDATools/__init__.py @@ -12,7 +12,7 @@ import threading -from pkg_resources import resource_filename +from importlib.resources import files from typing import Tuple @@ -105,11 +105,11 @@ def _create_if_not_exists(path): _create_if_not_exists(NDA_TOOLS_SETTINGS_FOLDER) if not pathlib.Path(NDA_TOOLS_LOGGING_YML_FILE).is_file(): - shutil.copyfile(resource_filename(__name__, 'clientscripts/config/logging.yml'), + shutil.copyfile(files(__name__) / 'clientscripts/config/logging.yml', NDA_TOOLS_LOGGING_YML_FILE) if not pathlib.Path(NDA_TOOLS_SETTINGS_CFG_FILE).is_file(): - shutil.copyfile(resource_filename(__name__, 'clientscripts/config/settings.cfg'), + shutil.copyfile(files(__name__) / 'clientscripts/config/settings.cfg', NDA_TOOLS_SETTINGS_CFG_FILE) # MAC users sometimes see output from python warnings module. Suppress these msgs os.environ['PYTHONWARNINGS'] = 'ignore'