Skip to content

Instantly share code, notes, and snippets.

@esamattis
Created August 4, 2011 12:18
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save esamattis/1125049 to your computer and use it in GitHub Desktop.
Save esamattis/1125049 to your computer and use it in GitHub Desktop.
What every python developer should have in their ~/.pdbrc
# Enable tab completion
import rlcompleter
import pdb
pdb.Pdb.complete = rlcompleter.Completer(locals()).complete
# Sometimes when you do something funky, you may lose your terminal echo. This
# should restore it when spanwning new pdb.
import termios, sys
termios_fd = sys.stdin.fileno()
termios_echo = termios.tcgetattr(termios_fd)
termios_echo[3] = termios_echo[3] | termios.ECHO
termios_result = termios.tcsetattr(termios_fd, termios.TCSADRAIN, termios_echo)
@xarg
Copy link

xarg commented Aug 4, 2011

2 most annoying things in pdb - solved! Thanks!

@nutjob4life
Copy link

Perfect. Thanks, epeli.

@olejorgenb
Copy link

This doesn't really work as expected...

locals is evaluated at init time so the actual locals wont be visible..

See http://code.activestate.com/recipes/498182/ for the proper method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment