Sfoglia il codice sorgente

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.
spezialspezial 2 anni fa
parent
commit
6524478850
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      modules/modelloader.py

+ 3 - 0
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: