From acfe5de23ae3afd79c9e0dd928cf3b7c96ae27c1 Mon Sep 17 00:00:00 2001 From: dat972 Date: Mon, 6 Jul 2026 23:50:22 -0500 Subject: [PATCH] updated polling so we wont timeout --- fccs_export.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fccs_export.py b/fccs_export.py index 92b5096..83c851c 100755 --- a/fccs_export.py +++ b/fccs_export.py @@ -177,6 +177,7 @@ def wait_for_export(app, ctrl, timeouts, log): 4. Dismiss it by clicking OK """ progress = app.window(title=ctrl["progress_title"], class_name=ctrl["progress_class"]) + saved = app.window(title=ctrl["saved_title"], class_name=ctrl["saved_class"]) try: progress.wait("visible", timeout=timeouts["progress_appear"]) @@ -185,15 +186,19 @@ def wait_for_export(app, ctrl, timeouts, log): log(" NOTE: progress dialog not seen; checking for confirmation dialog " "(drawer may have exported very quickly).") - try: - progress.wait_not("visible", timeout=timeouts["progress_finish"]) - except timings.TimeoutError: + # Poll until the confirmation dialog appears OR we time out. + # We do NOT rely on wait_not for the progress dialog because it can + # briefly disappear and reappear during long exports. + deadline = time.time() + timeouts["progress_finish"] + while time.time() < deadline: + # Check if the confirmation dialog has appeared + if saved.exists(timeout=0): + break + time.sleep(2) + else: log(f" ERROR: export did not finish within {timeouts['progress_finish']}s.") return False - # Look for the confirmation dialog — try multiple times with short waits - # since there can be a delay between progress closing and confirmation appearing. - saved = app.window(title=ctrl["saved_title"], class_name=ctrl["saved_class"]) try: saved.wait("visible ready", timeout=timeouts["confirm"]) log(" Confirmation dialog appeared - export succeeded.")