Skip to content
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

Display ExceptionGroup full message #287

Open
jbvsmo opened this issue Mar 10, 2023 · 0 comments
Open

Display ExceptionGroup full message #287

jbvsmo opened this issue Mar 10, 2023 · 0 comments

Comments

@jbvsmo
Copy link

jbvsmo commented Mar 10, 2023

Python3.11 added the concept of exception groups and this is how the traceback is displayed on normal Python console:

>>> eg = ExceptionGroup('foo', [TypeError(10), ValueError(20)])
>>> raise eg
  + Exception Group Traceback (most recent call last):
  |   File "<stdin>", line 1, in <module>
  | ExceptionGroup: foo (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | TypeError: 10
    +---------------- 2 ----------------
    | ValueError: 20
    +------------------------------------

But on lates jupyter console 6.6.3 (also qtconsole) it shows as:

In [1]: eg = ExceptionGroup('foo', [TypeError(10), ValueError(20)])
In [2]: raise eg
---------------------------------------------------------------------------
ExceptionGroup                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 raise eg

ExceptionGroup: foo (2 sub-exceptions)

According to PEP 654 you have to recursively go through the ExceptionGroup.exceptions and display them all which can include more exception groups.

Side note. If you type ExceptionG<tab>, or Ex<tab><tab> it will not autocomplete the name ExceptionGroup. It will though autocomplete Exception at the 1st <tab>... Something to check why

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

No branches or pull requests

1 participant