From 87f283cc98ccb7743cfefd54b063d23142040431 Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Fri, 3 Sep 2021 19:24:28 +1000 Subject: [PATCH] Fix backup config location --- bdfr/connector.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bdfr/connector.py b/bdfr/connector.py index 0e78c8c..78ddc4f 100644 --- a/bdfr/connector.py +++ b/bdfr/connector.py @@ -184,8 +184,9 @@ class RedditConnector(metaclass=ABCMeta): logger.debug(f'Loading configuration from {path}') break if not self.config_location: - self.config_location = list(importlib.resources.path('bdfr', 'default_config.cfg').gen)[0] - shutil.copy(self.config_location, Path(self.config_directory, 'default_config.cfg')) + with importlib.resources.path('bdfr', 'default_config.cfg') as path: + self.config_location = path + shutil.copy(self.config_location, Path(self.config_directory, 'default_config.cfg')) if not self.config_location: raise errors.BulkDownloaderException('Could not find a configuration file to load') self.cfg_parser.read(self.config_location)