Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Resolved crashing nodes caused by `FileNotFoundError` during directory traversal

TFWol4ab0392f707b
diff --git a/folder_paths.py b/folder_paths.py
index 641e5f0b2..4abed783b 100644
--- a/folder_paths.py
+++ b/folder_paths.py
@@ -138,15 +138,20 @@ def recursive_search(directory, excluded_dir_names=None):
excluded_dir_names = []
result = []
- dirs = {directory: os.path.getmtime(directory)}
+ dirs = {}
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:
relative_path = os.path.relpath(os.path.join(dirpath, file_name), directory)
result.append(relative_path)
+
for d in subdirs:
path = os.path.join(dirpath, d)
- dirs[path] = os.path.getmtime(path)
+ try:
+ dirs[path] = os.path.getmtime(path)
+ except FileNotFoundError:
+ print(f"Warning: Unable to access {path}. Skipping this path.")
+ continue
return result, dirs
def filter_files_extensions(files, extensions):