Catch UnicodeDecodeError to prevent corrupted yaml files from breaking the extension

As mentioned in #240
This commit is contained in:
DominikDoom
2023-09-17 15:28:34 +02:00
parent ba9dce8d90
commit 1c693c0263

View File

@@ -96,8 +96,8 @@ def get_yaml_wildcards():
parse_dynamic_prompt_format(yaml_wildcards, data, path)
else:
print('No data found in ' + path.name)
except yaml.YAMLError:
print('Issue in parsing YAML file ' + path.name)
except (yaml.YAMLError, UnicodeDecodeError) as e:
print(f'Issue in parsing YAML file {path.name}: {e}')
continue
# Sort by count