From 6298c72c492fbd1c699ec7edc10fb9b7e7ec0b30 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Thu, 12 Sep 2019 21:51:11 +0200 Subject: [PATCH] Close pystencils' config file after writing --- pystencils/cpu/cpujit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pystencils/cpu/cpujit.py b/pystencils/cpu/cpujit.py index b69de887..00fe25c7 100644 --- a/pystencils/cpu/cpujit.py +++ b/pystencils/cpu/cpujit.py @@ -173,7 +173,8 @@ def read_config(): config = recursive_dict_update(config, loaded_config) else: create_folder(config_path, True) - json.dump(config, open(config_path, 'w'), indent=4) + with open(config_path, 'w') as f: + json.dump(config, f, indent=4) if config['cache']['object_cache'] is not False: config['cache']['object_cache'] = os.path.expanduser(config['cache']['object_cache']).format(pid=os.getpid()) -- GitLab