Warn on import problems.

If there is a problem with files matching the capture
globs but not matching the file name regexp patterns,
these routines will emit a message to stderr and skip
the non-matching file.
This commit is contained in:
D. Berge
2020-08-28 17:28:03 +02:00
parent 639ac237e3
commit 22f806e81e
4 changed files with 24 additions and 0 deletions

View File

@@ -51,6 +51,12 @@ if __name__ == '__main__':
print("Importing")
match = rx.match(os.path.basename(filepath))
if not match:
error_message = f"File path not match the expected format! ({filepath} ~ {pattern['regex']})"
print(error_message, file=sys.stderr)
print("This file will be ignored!")
continue
file_info = dict(zip(pattern["captures"], match.groups()))
p190_data = p190.from_file(filepath, with_objrefs=True)