How to get full traceback in Python Notebook by using "%tb"?

Question:

I ran some python code block on a Jupyter Notebook and got

An exception has occurred, use %tb to see the full traceback.

error/warning followed by a single line of traceback.

I want to see the full traceback as suggested. But I didn’t understand what %tb is how and where I can use it. Is it an argument that I should’ve given to jupyter command or is it something I should’ve used in python code (sth like printf("%tb", whatIsSupposedToBeHere) )?

I have searched both this error message and ways to read tracebacks in python and j. notebook. I tried some answers to this and that but couldn’t get anything useful.

ps. This is not an XY problem.
Yes I want to see full traceback (X) and I am asking a subproblem that encountered while trying a solution particularly how to use %tb (Y). However, i want to learn the solution of Y independent of its relation to solving X.

Answers:

%tb is a Jupyter notebook "magic" command

Just type it into an empty cell of the Jupyter notebook, and it will show the traceback of the last error you had on that kernel.

enter image description here

More info on Jupyter notebook "magics":
https://ipython.readthedocs.io/en/stable/interactive/magics.html

Answered By: ProfDFrancis