Log missing files, but try to continue execution

This commit is contained in:
Michael Hohn
2021-11-16 21:45:54 -08:00
committed by =Michael Hohn
parent 502cb21850
commit 9f3be7bcb0

View File

@@ -52,6 +52,9 @@ def load_lines(root, path, line_from, line_to):
Newlines are dropped.
"""
fname = os.path.join(root, path)
if not os.path.exists(fname):
dbg("Missing file: %s" % fname)
return []
with open(fname, 'r') as file:
lines = file.readlines()
return [line.rstrip("\n\r").replace("\t", " ")