From b289dcea82bac461cf879be5935e64a1ff192622 Mon Sep 17 00:00:00 2001 From: Deniz Turgut Date: Sat, 28 Oct 2023 17:30:45 +0300 Subject: [PATCH] don't watch not existing paths --- pelican/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index 1225e479..84a18deb 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -764,21 +764,25 @@ def wait_for_changes(settings_file, reader_class, settings): fnmatch.translate(pattern) for pattern in settings.get('IGNORE_FILES', []) ) - watching_paths = [ + candidate_paths = [ settings_file, theme_path, content_path, ] - watching_paths.extend( + candidate_paths.extend( os.path.join(content_path, path) for path in settings.get('STATIC_PATHS', []) ) - watching_paths = [os.path.abspath(p) for p in watching_paths if p] - - for path in watching_paths: + watching_paths = [] + for path in candidate_paths: + if not path: + continue + path = os.path.abspath(path) if not os.path.exists(path): logger.warning("Unable to watch path '%s' as it does not exist.", path) + else: + watching_paths.append(path) return next(watchfiles.watch( *watching_paths,