Close file before returning

This commit is contained in:
Alan Rominger 2021-06-25 14:17:51 -04:00
parent 2afa406b7f
commit 02cccbe608
No known key found for this signature in database
GPG Key ID: C2D7EAAA12B63559

View File

@ -89,9 +89,9 @@ def load_file(filename):
path = local(filename)
if path.check():
fp = path.open()
# FIXME - support load_all()
return yaml.load(fp, Loader=Loader)
with open(path, 'r') as fp:
# FIXME - support load_all()
return yaml.load(fp, Loader=Loader)
else:
msg = 'Unable to load data file at %s' % path
raise Exception(msg)