Fix missing key error

This commit is contained in:
Schimon Jehudah 2024-01-02 18:45:43 +00:00
parent de200b3b03
commit 9843337e43

View file

@ -61,10 +61,19 @@ def get_value(filename, section, keys):
if isinstance(keys, list): if isinstance(keys, list):
result = [] result = []
for key in keys: for key in keys:
result.extend([section_res[key]]) try:
value = section_res[key]
except:
print("Missing key:", key)
value = ''
result.extend([value])
elif isinstance(keys, str): elif isinstance(keys, str):
key = keys key = keys
result = section_res[key] try:
result = section_res[key]
except:
print("Missing key:", key)
result = ''
return result return result