Question about %psource in notebook

Hi all. In the not-too-distant past %psource would display source code as the output of a cell. Now it pops up a window. Is there any way to get the old behavior back?

I can use the inspect module to get the source code and print it myself, but I don’t get syntax highlighting.


1 Like

@AllenDowney Yeah, you can set the IPython pager to print. Add the following lines to the beginning of your notebook.

from IPython.core import page = print

Then try %psource.

Is this what you were looking for?