From 86ed1e7a6fb6fcb958ca3ce12f60e8a41538f0ce Mon Sep 17 00:00:00 2001 From: sko00o Date: Tue, 11 Mar 2025 18:26:05 +0800 Subject: [PATCH] Handle non-existent paths in path dictionary creation --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index f83351d..19f7592 100644 --- a/nodes.py +++ b/nodes.py @@ -45,7 +45,7 @@ def create_path_dict(paths: list[str], predicate: Callable[[Path], bool] = lambd Default: Include everything """ - flattened_paths = [item for path in paths for item in Path(path).iterdir() if predicate(item)] + flattened_paths = [item for path in paths if Path(path).exists() for item in Path(path).iterdir() if predicate(item)] return {item.name: str(item.absolute()) for item in flattened_paths}