aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspezialspezial <75758219+spezialspezial@users.noreply.github.com>2023-02-04 15:52:15 +0000
committerGitHub <noreply@github.com>2023-02-04 15:52:15 +0000
commit6524478850ba1b285fee2593b113dfb726b0bd9f (patch)
tree5f4c48a15a6aff13a50769b1900983564998a0e8
parent3e0f9a75438fa815429b5530261bcf7d80f3f101 (diff)
downloadstable-diffusion-webui-gfx803-6524478850ba1b285fee2593b113dfb726b0bd9f.tar.gz
stable-diffusion-webui-gfx803-6524478850ba1b285fee2593b113dfb726b0bd9f.tar.bz2
stable-diffusion-webui-gfx803-6524478850ba1b285fee2593b113dfb726b0bd9f.zip
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.
-rw-r--r--modules/modelloader.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/modelloader.py b/modules/modelloader.py
index e9aa514e..fc3f6249 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: