closing cache file

This commit is contained in:
Julian Hammer
2020-03-20 15:02:30 +01:00
parent 2b28707185
commit 16cae4445b
2 changed files with 4 additions and 3 deletions

View File

@@ -318,7 +318,8 @@ class MachineModel(object):
# Check if modification date of DB is older than cached version
if os.path.getmtime(filepath) < os.path.getmtime(cachepath):
# load cached version
cached_db = pickle.load(open(cachepath, 'rb'))
with open(cachepath, 'rb') as f:
cached_db = pickle.load(f)
return cached_db
else:
# DB newer than cached version --> delete cached file and return False

View File

@@ -91,8 +91,8 @@ setup(
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'networkx',
'pyparsing',
'ruamel.yaml',
'pyparsing>=2.3.1',
'ruamel.yaml>=0.15.71',
],
python_requires='>=3.5',