From feadc6a565aa4226df38d52e970ecb2382407725 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 14 Sep 2017 02:13:49 +0200 Subject: [PATCH] make sure config exists before writing to it --- fdroidserver/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 182949d9..fe0462c7 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -2314,7 +2314,10 @@ def write_to_config(thisconfig, key, value=None, config_file=None): value = thisconfig[origkey] if origkey in thisconfig else thisconfig[key] cfg = config_file if config_file else 'config.py' - # load config file + # load config file, create one if it doesn't exist + if not os.path.exists(cfg): + os.mknod(cfg) + logging.info("Creating empty " + cfg) with open(cfg, 'r', encoding="utf-8") as f: lines = f.readlines() -- 2.30.2