Skip to content

Commit 6365c1d

Browse files
committed
fix: prevent error message spam on progress error
1 parent 6f147f5 commit 6365c1d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/nutpie/sample.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,18 @@ def __init__(
457457

458458
self.display_id = IPython.display.display(self, display_id=True)
459459

460+
did_print_error = False
461+
460462
def callback(formatted):
463+
nonlocal did_print_error
464+
461465
try:
462466
self._html = formatted
463467
self.display_id.update(self)
464468
except Exception as e:
465-
print(f"Error updating progress display: {e}")
469+
if not did_print_error:
470+
did_print_error = True
471+
print(f"Error updating progress display: {e}")
466472

467473
progress_type = _lib.ProgressType.template_callback(
468474
progress_rate, progress_template, cores, callback

0 commit comments

Comments
 (0)