[Python-mode] making stack traces clickable in gud.el pdb output.

m h sesquile at gmail.com
Tue Jan 19 23:06:43 CET 2010


Thanks much for the responses!

On Tue, Jan 19, 2010 at 2:25 PM, Barry Warsaw <barry at python.org> wrote:
> On Jan 19, 2010, at 12:18 PM, m h wrote:
>
>>Wow, didn't you add python support to gud?
>
> If I did, it was a million years ago and I don't remember it ;).
>

:)

>>Would you (or anyone else) care to mention their workflow?  I've just
>>been trying to get python-mode C-c C-c to allow me to use pdb.  But I
>>get an error:
>>
>>> <stdin>(181)_test()
>>(Pdb)
>>Traceback (most recent call last):
>>  File "<stdin>", line 186, in <module>
>>  File "<stdin>", line 181, in _test
>>  File "<stdin>", line 181, in _test
>>  File "/usr/lib64/python2.6/bdb.py", line 46, in trace_dispatch
>>    return self.dispatch_line(frame)
>>  File "/usr/lib64/python2.6/bdb.py", line 65, in dispatch_line
>>    if self.quitting: raise BdbQuit
>>bdb.BdbQuit
>>
>>How do I invoke pdbtrack from python-mode?
>
> It's really easy.  You still insert 'import pdb; pdb.set_trace()' at the spot
> in your code where you want to break.  Then run your code from a shell buffer.
> When you hit the break point, you'll drop into pdb.  pdb-track will notice the
> new prompt and you'll be able to interact with it right there.  You'll use pdb
> commands but you'll get the nice two-screen view with code tracking.
>

So just to be explicit about what 'run your code from a shell buffer'.  I tried:

1- C-c !
2- type `execfile('filename.py')` into python shell
3- hit breakpoint/nirvana

Is that how you do it, or is there another way?  It'd be nice not to
have to type out part 2.  Right now I have a macro bound to f-11 that
re-runs my last pdb command.  I guess M-p (like ctr-p in terminal)
works ok too in  that it scrolls through the command histories.

So that get's rid of one of my problems (gud/pdb scrolls buffer to
top).  Anyway to make it recognize files and make them clickable in
the python shell?

cheers-

-matt

-matt


More information about the Python-mode mailing list