debugging python script in ipython
ipython doesn't work with built-in pdb debugger. While I tried to debug a python script with "run -d script.py" within ipython shell, I got bellow error:
To debug script in ipython, we need to use a different debugger, pydb, for example. There are only three steps to setup and use it.
Because pydb use the same set of commands with gdb, it's fairly straightforward to get start with it if you have done some debugging in gdb. This is one reason why I pick it as my debugger.
Reference:
Introducing the pydb Debugger
Debugging in Python
AttributeError: Pdb instance has no attribute 'curframe'
To debug script in ipython, we need to use a different debugger, pydb, for example. There are only three steps to setup and use it.
- download and install pydb.
- start ipython with -pydb argument: ipython -pydb
- start debugging with: run -d script.py
KeyError: 'HOME'
It can be solved by adding HOME environment variable.Because pydb use the same set of commands with gdb, it's fairly straightforward to get start with it if you have done some debugging in gdb. This is one reason why I pick it as my debugger.
Reference:
Introducing the pydb Debugger
Debugging in Python