Close file before returning

This commit is contained in:
Alan Rominger
2021-06-25 14:17:51 -04:00
parent 2afa406b7f
commit 02cccbe608

View File

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