From e5bd40baac7222c3710a3544565f379be1fc7e55 Mon Sep 17 00:00:00 2001 From: Julian Hammer Date: Fri, 20 Mar 2020 15:02:30 +0100 Subject: [PATCH] closing cache file --- osaca/semantics/hw_model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osaca/semantics/hw_model.py b/osaca/semantics/hw_model.py index ef6a61d..a904b32 100755 --- a/osaca/semantics/hw_model.py +++ b/osaca/semantics/hw_model.py @@ -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