Fix missing key error
This commit is contained in:
parent
de200b3b03
commit
9843337e43
1 changed files with 11 additions and 2 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue