From 08b7c58ea72774244c940d86f676f32a168f83d0 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Sat, 2 Nov 2024 15:52:10 +0100 Subject: [PATCH] More catches for fixing #308 --- scripts/tag_autocomplete_helper.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index a7abf33..c105de6 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -160,9 +160,12 @@ def parse_dynamic_prompt_format(yaml_wildcards, data, path): elif not (isinstance(value, list) and all(isinstance(v, str) for v in value)): del d[key] - recurse_dict(data) - # Add to yaml_wildcards - yaml_wildcards[path.name] = data + try: + recurse_dict(data) + # Add to yaml_wildcards + yaml_wildcards[path.name] = data + except: + return def get_yaml_wildcards(): @@ -187,9 +190,13 @@ def get_yaml_wildcards(): parse_dynamic_prompt_format(yaml_wildcards, data, path) else: print('No data found in ' + path.name) - except (yaml.YAMLError, UnicodeDecodeError) as e: + except (yaml.YAMLError, UnicodeDecodeError, AttributeError, TypeError) as e: + # YAML file not in wildcard format or couldn't be read print(f'Issue in parsing YAML file {path.name}: {e}') continue + except Exception as e: + # Something else went wrong, just skip + continue # Sort by count umi_sorted = sorted(umi_tags.items(), key=lambda item: item[1], reverse=True)