Popular recipes by Stephen Emslie http://code.activestate.com/recipes/users/4004606/2009-07-06T04:35:33-07:00ActiveState Code Recipessane tab completion in pdb (Python)
2009-07-06T04:35:33-07:00Stephen Emsliehttp://code.activestate.com/recipes/users/4004606/http://code.activestate.com/recipes/498182-sane-tab-completion-in-pdb/
<p style="color: grey">
Python
recipe 498182
by <a href="/recipes/users/4004606/">Stephen Emslie</a>
(<a href="/recipes/tags/complete/">complete</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/pdb/">pdb</a>, <a href="/recipes/tags/tab/">tab</a>).
Revision 6.
</p>
<p>I make frequent use of python's built-in debugger, but one obvious feature seems to be missing - the bash-like tab completion that you can add to the interpreter. Fortunately pdb's interactive prompt is an instance of Cmd, so we can write our own completion function.</p>
<p>Note: this uses rlcompleter, which isn't available on windows</p>
<p>Edit (6 Jul 2009): import rlcompleter early and force output to stdout to ensure monkeypatch sticks
Edit: updated to handle changes in local scope
Edit: Fixed start via 'python -m pdb ...'. Check the comments for details.</p>