Differences between revisions 12 and 13
Revision 12 as of 2013-05-19 23:53:45
Size: 1392
Editor: 99-129-250-188
Comment:
Revision 13 as of 2015-09-04 18:40:30
Size: 1384
Editor: ::ffff:161
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 8: Line 7:

Line 15: Line 12:

where `[args]` represents optional arguments, to launch PuDB from within
IPython.
where `[args]` represents optional arguments, to launch PuDB from within IPython.
Line 20: Line 15:
Line 24: Line 20:
Line 27: Line 24:
The execution of your code will stop at the chosen line giving you access to the PuDB window.
This is a quite effective way to debug your code, especially when you have several source files.
The execution of your code will stop at the chosen line giving you access to the PuDB window.  This is a quite effective way to debug your code, especially when you have several source files.
Line 31: Line 27:

IPython integration

PuDB ships with IPython integration. Just stick the line:

import pudb.ipython

into your $HOME/.ipython/ipy_user_conf.py (for IPython 0.10) or $HOME/ipython/profile_default/ipython_config.py  (for IPython 0.11+), and then you may use the magic command:

%pudb script.py [args]

where [args] represents optional arguments, to launch PuDB from within IPython.

An alternative way to debug your code using PuDB and IPython is to simply insert the following:

import pudb; pudb.set_trace()

in your source code where you want the execution to stop. From IPython you can simply issue the command:

%run your_code.py

The execution of your code will stop at the chosen line giving you access to the PuDB window. This is a quite effective way to debug your code, especially when you have several source files.

Using PuDB as IPython's on-failure debugger

As of this writing (07/2010), IPython is undergoing a major refactoring, which may include better support for third-party debuggers such as PuDB. In the meantime, David Warde-Farley made an initial attempt at this: patch against IPython/iplib.py, thread on IPython-dev. Currently it intercepts %debug but not the %pdb autocall behaviour.

PuDB/IPythonIntegration (last edited 2015-09-04 18:40:30 by ::ffff:161)