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
1 changed files with 4 additions and 1 deletions

View File

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