iPython doesn't show exception.add_note()

Open
#1,115 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
jupyter-notebook, python
Domain
backend

Research direction

Reproduce the issue in a Jupyter notebook using a Python 3.11 kernel, then compare its traceback with the Python REPL output shown in the report. Trace how the kernel formats and sends exceptions, and consider the issue done when exception notes appear in the notebook traceback as they do in the REPL.

Written by the indexing model from the issue text.

Description

PEP 678 added in 3.11 allows enriching exceptions with notes. This works in the REPL:

>>> try:
...   raise TypeError('bad type')
... except Exception as e:
...   e.add_note('Add some information')
...   raise
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: bad type
Add some information

Entering the same in a Jupyter notebook using a 3.11 kernel, I don't see the note:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Untitled-1.ipynb Cell 1 in 2
      1 try:
----> 2   raise TypeError('bad type')
      3 except Exception as e:
      4   e.add_note('Add some information')

TypeError: bad type

Related issue: https://github.com/microsoft/vscode-jupyter/issues/13446

Dominant language
Python
Stars
734
Forks
411
Avg merge
1d 2h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ipython/ipykernel

All issues in ipython/ipykernel

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.