From 6524478850ba1b285fee2593b113dfb726b0bd9f Mon Sep 17 00:00:00 2001 From: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Sat, 4 Feb 2023 16:52:15 +0100 Subject: [PATCH] Update modelloader.py os.path.getmtime(filename) throws exception later in codepath when meeting broken symlink. For now catch it here early but more checks could be added for robustness. --- modules/modelloader.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/modelloader.py b/modules/modelloader.py index e9aa514eb..fc3f6249f 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -45,6 +45,9 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None full_path = file if os.path.isdir(full_path): continue + if os.path.islink(full_path) and not os.path.exists(full_path): + print(f"Skipping broken symlink: {full_path}") + continue if ext_blacklist is not None and any([full_path.endswith(x) for x in ext_blacklist]): continue if len(ext_filter) != 0: -- GitLab