From: Guillaume Pellerin Date: Sun, 4 Feb 2024 21:43:25 +0000 (+0100) Subject: fix write_conf X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d856aeaee74313915a292a1b9426e77b17256874;p=deefuzzer.git fix write_conf --- 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):