From 1dab412c79eccdd055265475a0bd31ba97e2cf9c Mon Sep 17 00:00:00 2001 From: TFWol <9045213+TFWol@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:06:33 -0800 Subject: [PATCH] Add error handling to initial fix to keep cache intact --- folder_paths.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/folder_paths.py b/folder_paths.py index 4abed78..ef9b8cc 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -139,6 +139,13 @@ def recursive_search(directory, excluded_dir_names=None): result = [] dirs = {} + + # Attempt to add the initial directory to dirs with error handling + try: + dirs[directory] = os.path.getmtime(directory) + except FileNotFoundError: + print(f"Warning: Unable to access {directory}. Skipping this path.") + for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True): subdirs[:] = [d for d in subdirs if d not in excluded_dir_names] for file_name in filenames: