From d856aeaee74313915a292a1b9426e77b17256874 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Sun, 4 Feb 2024 22:43:25 +0100 Subject: [PATCH] fix write_conf --- deefuzzer/tools/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deefuzzer/tools/utils.py b/deefuzzer/tools/utils.py index f2573c5..cb896ad 100644 --- a/deefuzzer/tools/utils.py +++ b/deefuzzer/tools/utils.py @@ -102,7 +102,6 @@ def get_conf_dict(file): elif 'json' in mime_type: import json - confile = open(file, 'r') data = confile.read() confile.close() @@ -113,20 +112,21 @@ def get_conf_dict(file): def write_conf(conf_dict, path): filename, ext = os.path.splitext(path) + f = open(path, 'w') if 'xml' in ext: xml_data = dicttoxml(conf_dict) - f = open(path, 'w') - f = confile.write(xml_data) - f.close() + f.write(xml_data) elif 'yaml' in ext or 'yml' in ext: import yaml - yaml.dump(conf_dict, path) + yaml.dump(conf_dict, f) elif 'json' in ext: import json - json.dump(conf_dict, path) + json.dump(conf_dict, f) + + f.close() def folder_contains_music(folder): -- 2.47.3