create config if it doesn't exist

This commit is contained in:
Lynne 2019-08-14 15:00:35 +10:00
parent 481b5c26fa
commit 02ca3d3a50

View file

@ -30,7 +30,10 @@ cfg = {
"strip_paired_punctuation": False "strip_paired_punctuation": False
} }
try:
cfg.update(json.load(open(args.cfg, 'r'))) cfg.update(json.load(open(args.cfg, 'r')))
except FileNotFoundError:
open(args.cfg, "w").write("{}")
print("Using {} as configuration file".format(args.cfg)) print("Using {} as configuration file".format(args.cfg))