Check for lineNameInfo when importing P1/11

This commit is contained in:
D. Berge
2025-08-07 11:00:42 +02:00
parent 8f87df1e2f
commit 7f5f64acb1
2 changed files with 41 additions and 28 deletions

View File

@@ -73,6 +73,12 @@ if __name__ == '__main__':
lineNameInfo = final_p111.get("lineNameInfo") lineNameInfo = final_p111.get("lineNameInfo")
pattern = final_p111.get("pattern") pattern = final_p111.get("pattern")
if not lineNameInfo:
if not pattern:
print("ERROR! Missing final.p111.lineNameInfo in project configuration. Cannot import final P111")
throw Exception("Missing final.p111.lineNameInfo")
else:
print("WARNING! No `lineNameInfo` in project configuration (final.p111). You should add it to the settings.")
rx = None rx = None
if pattern and pattern.get("regex"): if pattern and pattern.get("regex"):
rx = re.compile(pattern["regex"]) rx = re.compile(pattern["regex"])

View File

@@ -41,6 +41,12 @@ if __name__ == '__main__':
lineNameInfo = raw_p111.get("lineNameInfo") lineNameInfo = raw_p111.get("lineNameInfo")
pattern = raw_p111.get("pattern") pattern = raw_p111.get("pattern")
if not lineNameInfo:
if not pattern:
print("ERROR! Missing raw.p111.lineNameInfo in project configuration. Cannot import raw P111")
throw Exception("Missing raw.p111.lineNameInfo")
else:
print("WARNING! No `lineNameInfo` in project configuration (raw.p111). You should add it to the settings.")
rx = None rx = None
if pattern and pattern.get("regex"): if pattern and pattern.get("regex"):
rx = re.compile(pattern["regex"]) rx = re.compile(pattern["regex"])
@@ -104,6 +110,7 @@ if __name__ == '__main__':
file_info["meta"] = { file_info["meta"] = {
"fileInfo": parsed_line "fileInfo": parsed_line
} }
p111_data = p111.from_file(physical_filepath) p111_data = p111.from_file(physical_filepath)
print("Saving") print("Saving")