Wednesday, August 7, 2013

IPython - How to step into library code without debug script

IPython - How to step into library code without debug script

If I need to view the stack or step within a library I can do this
In [1]: run -d script.py
ipdb> b some_library:nnn
ipdb> c
> path/to/some_library.py(nnn).function
nnn
...
But if I want to do the same directly on the console without using a script.
For instance
In [1]: from django.contrib.auth.models import User
In [2]: user = User.objects.get(pk=1)
Now to step into the call user.email_user I have tried
In [3]: debug
ipdb> b socket:nnn
ipdb> user.email_user('test', 'test message')
But it does not break at the line in socket.py. Given how many options
there are with ipython, I feel like I am missing something obvious in not
being able to do this directly from the console rather than writing a
script to step through.

No comments:

Post a Comment