From 86ead9b43df03aaddb3621d28be512453e1b650e Mon Sep 17 00:00:00 2001 From: Piotr Zaborowski Date: Thu, 2 Feb 2023 14:37:07 +0100 Subject: [PATCH] Add failsafe for badly formatted UmiAI YAML files --- scripts/tag_autocomplete_helper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index e7a48d6..29cdf25 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -71,8 +71,11 @@ def get_ext_wildcard_tags(): with open(path, encoding="utf8") as file: data = yaml.safe_load(file) for item in data: - wildcard_tags[count] = ','.join(data[item]['Tags']) - count += 1 + if data[item] and 'Tags' in data[item]: + wildcard_tags[count] = ','.join(data[item]['Tags']) + count += 1 + else: + print('Issue with tags found in ' + path.name + ' at item ' + item) except yaml.YAMLError as exc: print(exc) # Sort by count