Deal better with additional label errors.

master
Sébastien Miquel 2026-03-28 10:46:42 +01:00
parent bd35e69534
commit f9d43e3ad9
1 changed files with 9 additions and 2 deletions

View File

@ -511,11 +511,13 @@ Here is a list of all possible labels. You need to answer with a list one of the
tprint(f"\tHandling additional-answer for {pid} {label}")
keep_error = False
error = "al:"
for add_label in add_labels:
if add_label == label:
continue
if add_label not in all_labels:
tprint(f"\t\t Inexistent label from additional-answer processing {pid} {label}. Ignoring")
tprint(f"\t\t Inexistent label ({add_label}) from additional-answer processing {pid} {label}. Ignoring")
error += f"{add_label}??"
keep_error = True
continue
new_pdf_path = Path(INPUT_DIR) / f"Copie{pid}" / f"{add_label}.pdf"
@ -530,11 +532,13 @@ Here is a list of all possible labels. You need to answer with a list one of the
add_label, False))
else:
keep_error = True
error += f"{add_label}"
tprint(f"\t\tAlready present (not copied) Copie{pid} : {label} -> {add_label}")
if not keep_error:
res["error"] = ""
else:
res["error"] = error
return new_tasks
@ -585,6 +589,9 @@ def process_single_task(task_tuple):
yming, ymaxg, width_r = d_data[pid]
pdf_path = Path(INPUT_DIR) / f"Copie{pid}" / f"{label}.pdf"
if !can_spawn_tasks and res["error"] == "additional-answer":
tprint("\tSwallowing an additional-answer from a subsequent task.")
res["error"]= ""
if res["error"] != "":
tprint("\tError :", res["error"], "for Copie", pid, group_name)