diff --git a/bin/import_final_p111.py b/bin/import_final_p111.py index 30142a4..b740dcf 100755 --- a/bin/import_final_p111.py +++ b/bin/import_final_p111.py @@ -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())) p111_data = p111.from_file(filepath) diff --git a/bin/import_final_p190.py b/bin/import_final_p190.py index 8a7475a..900c8d3 100755 --- a/bin/import_final_p190.py +++ b/bin/import_final_p190.py @@ -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) diff --git a/bin/import_raw_p111.py b/bin/import_raw_p111.py index 9abc494..3902b81 100755 --- a/bin/import_raw_p111.py +++ b/bin/import_raw_p111.py @@ -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())) p111_data = p111.from_file(filepath) diff --git a/bin/import_raw_p190.py b/bin/import_raw_p190.py index 7665fef..116b611 100755 --- a/bin/import_raw_p190.py +++ b/bin/import_raw_p190.py @@ -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)