Close file in read_image()

This commit is contained in:
Thomas Rubini 2023-01-13 13:44:40 +01:00
parent f15291031a
commit d5fdeb80ce
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -249,9 +249,10 @@ def generateGameData(LANG):
def read_image(path:str):
try:
return open(path, "rb").read()
except:
return 1
with open(path, "rb") as f:
return f.read()
except IOError:
return None
def get_trait_id_from_string(trait):
return get_trait_from_text(trait)