Login or Sign up

ipython shell for debugging

Posted by: skyl on Feb. 5, 2010

I owe all credit for knowing about this to this blog post. It's about the most useful thing I've ever seen since starting python a few years ago.

You can pip install ipython in your environment. Then, in the module you would like to debug:

from IPython.Shell import IPShellEmbed
ipython = IPShellEmbed()

Where you want to drop into the shell during execution:

ipython()

The program will hang at that point and give you an ipython prompt. You will have all of the local and global context of the suite from which you launch the shell, ready for inspection.

Comments on This Post:

Please Login (or Sign Up) to leave a comment