From d75ed52bfc07746c28ecd3bc35d76c2a6e1ce6ea Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 9 Jun 2023 13:26:36 +0300 Subject: [PATCH] Don't die when a LoRA is a broken symlink Fixes #11098 --- extensions-builtin/Lora/lora.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions-builtin/Lora/lora.py b/extensions-builtin/Lora/lora.py index af93991c..34ff57dd 100644 --- a/extensions-builtin/Lora/lora.py +++ b/extensions-builtin/Lora/lora.py @@ -448,7 +448,11 @@ def list_available_loras(): continue name = os.path.splitext(os.path.basename(filename))[0] - entry = LoraOnDisk(name, filename) + try: + entry = LoraOnDisk(name, filename) + except OSError: # should catch FileNotFoundError and PermissionError etc. + errors.report(f"Failed to load LoRA {name} from {filename}", exc_info=True) + continue available_loras[name] = entry