handle case when .ftl file doesn't exist yet

This commit is contained in:
Damien Elmes 2021-03-03 18:57:41 +10:00
parent 92aaaf7146
commit 65acf70df4

View File

@ -46,10 +46,10 @@ def write_entry(fname, key, entry):
entry.id.name = key
if not os.path.exists(fname):
return
with open(fname) as file:
orig = file.read()
orig = ""
else:
with open(fname) as file:
orig = file.read()
obj = parse(orig)
for ent in obj.body:
if isinstance(ent, Junk):