* Avoid error message on first time config save.
authorUrban Wallasch <urban.wallasch@freenet.de>
Wed, 16 Jun 2021 17:21:03 +0000 (19:21 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Wed, 16 Jun 2021 17:21:03 +0000 (19:21 +0200)
jiten-pai.py

index 66c14f6cfe291aa8c02ce52daafeb0e239acf43a..437529209b45abb5914ec00dca9fd245574ebbdd 100755 (executable)
@@ -89,12 +89,13 @@ cfg = {
 def _save_cfg():
     s_cfg = cfg.copy()
     s_cfg.pop('cfgfile', None)
-    try:
-        with open(cfg['cfgfile'], 'w') as cfgfile:
-            json.dump(s_cfg, cfgfile, indent=2)
-            return
-    except Exception as e:
-        eprint(cfg['cfgfile'], str(e))
+    if cfg['cfgfile']:
+        try:
+            with open(cfg['cfgfile'], 'w') as cfgfile:
+                json.dump(s_cfg, cfgfile, indent=2)
+                return
+        except Exception as e:
+            eprint(cfg['cfgfile'], str(e))
     cdirs = []
     if os.environ.get('APPDATA'):
         cdirs.append(os.environ.get('APPDATA'))