Skip to content

WIP, publish error tracebacks on iopub #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomjakubowski
Copy link

This ensures that when an Output ipywidget is used as a context manager, errors raised inside the context are rendered in the Output widget.

out = Output()
out

with out:
    raise RuntimeError("oh no! an error occurred")

However, it does not suppress the error in the original cell, which is to say the error is rendered both in the original cell and in the Output widget. This behavior is in contrast to Jupyter Lab and Notebook, which do suppress the error in the original cell. Fixing this is a TODO.

This patch also handles the case where an ipywidgets handler, without the @out.capture() decorator, raises an exception. Such exceptions are now seen in the log console.

TODOs:

  • Suppress error in the original cell

This ensures that when an Output ipywidget is used as a context manager,
errors raised inside the context are rendered in the Output widget.

```
out = Output()
out

with out:
    raise RuntimeError("oh no! an error occurred")
```

However, it does not suppress the error in the original cell, which is
to say the error is rendered both in the original cell and in the Output
widget.  This behavior is in contrast to Jupyter Lab and Notebook, which
do suppress the error in the original cell.  Fixing this is a TODO.

This patch also handles the case where an ipywidgets handler, without
the `@out.capture()` decorator, raises an exception.  Such exceptions
are now seen in the log console.

TODOs:
- [ ] Suppress error in the original cell
Copy link
Contributor

lite-badge 👈 Try it on ReadTheDocs

@tomjakubowski
Copy link
Author

tomjakubowski commented Jul 18, 2025

When I say this patch currently fails to suppress the error in the original cell, I mean this. Compare the cell outputs in Jupyter Notebook with ipykernel:

Screenshot 2025-07-17 at 11 16 59 PM

and the cell outputs in Jupyter Lite, with this patch to pyodide-kernel:

Screenshot 2025-07-17 at 11 17 25 PM

In Lite, the error is now incorrectly appearing in two cells, when it should only be in the Output widget's cell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant