diff --git a/src/scwidgets/check/_check.py b/src/scwidgets/check/_check.py index 16532d7..2aa0fbd 100644 --- a/src/scwidgets/check/_check.py +++ b/src/scwidgets/check/_check.py @@ -218,7 +218,9 @@ def check_function(self) -> ChecksResult: if self._fingerprint is not None: try: output = self._fingerprint(*output) - except Exception as exception: + except ( # we do not raise here since it is passed to widget output # noqa B040 + Exception + ) as exception: if python_version() >= "3.11": exception.add_note( "An error was raised in fingerprint function, " diff --git a/src/scwidgets/exercise/_widget_code_exercise.py b/src/scwidgets/exercise/_widget_code_exercise.py index 0d15f36..257c9e2 100644 --- a/src/scwidgets/exercise/_widget_code_exercise.py +++ b/src/scwidgets/exercise/_widget_code_exercise.py @@ -657,6 +657,11 @@ def _on_click_update_action(self) -> bool: raised_error = True raise e + # The clear_output command at the beginning of the function waits till + # something is printed. If nothing is printed, it is not cleared. We + # enforce it to be invoked by printing an empty string + print("", end="") + return not (raised_error) def run_update(self):