
The combination of these two packages is extremely powerful and allows one to recreate exactly the behavior described in the OP and do even more.
#Debug script python how to#
(Update on May 28, 2016) Using RealGUD in Emacsįor anyone in Emacs, this thread shows how to accomplish everything described in the OP (and more) using
#Debug script python full#
Ideally, Emacs (or the editor) would allow the programmer to set breakpoints anywhere on the code and communicate with the interpreter or debugger to have it stop in the location of your choice, and bring to a full IPython interpreter on that location. I don't want to make the question too specific, but I work mostly in Emacs, so I wonder if there is any way to bring this functionality into it. IPython debugging in Emacs and other editors: From what I have discussed with other users, this is the debugging feature that people miss the most when moving from MATLAB to IPython. on a given statement), have access to a full-fledged IPython shell.Īn example of this type of "enhanced debugging" can be found in MATLAB, where the user always has full access to the MATLAB engine/shell, and she can still step-by-step through her code, define conditional breakpoints, etc. Be able to step-by-step through your code with handy pdb/ipdb keyboard shortcuts.Is there any way to combine the best of both worlds? I.e. However, when using embed() you can't step-by-step through the code anymore with handy keyboard shortcuts. This allows the full inspection of objects and testing of Python code using all the IPython goodies. When your program/script hits an embed() statement, you are dropped into an IPython shell. You can do from IPython import embed, and then use embed() in your code. Using IPython by embedding an IPython shell in your code.


This supports commands such as c for continue, n for step-over, s for step-into etc.), but you don't have direct access to an IPython shell which can be extremely useful for object inspection. With a traditional debugger such as pdb or ipdb. From what I have read, there are two ways to debug code in Python:
