From 82096a37d1ad0bae9a8991d91c2d16c75353833e Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Wed, 16 Jun 2021 19:21:03 +0200 Subject: [PATCH] * Avoid error message on first time config save. --- jiten-pai.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jiten-pai.py b/jiten-pai.py index 66c14f6..4375292 100755 --- a/jiten-pai.py +++ b/jiten-pai.py @@ -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')) -- 2.30.2