1 # Command line history:
3 histfile = os.path.expanduser("~/.pdb-history")
6 readline.read_history_file(histfile)
10 def savehist(histfile=histfile):
12 histfilesize = os.environ.get('HISTFILESIZE') or \
13 os.environ.get('HISTSIZE')
16 histfilesize = int(histfilesize)
20 readline.set_history_length(histfilesize)
21 readline.write_history_file(histfile)
24 atexit.register(savehist)
26 # return to debugger after fatal exception (Python cookbook 14.5):
28 def info(type, value, tb):
29 if hasattr(sys, 'ps1') or not sys.stderr.isatty():
30 sys.__excepthook__(type, value, tb)
32 traceback.print_exception(type, value, tb)
37 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498182
38 import pdb, rlcompleter
39 pdb.Pdb.complete = rlcompleter.Completer().complete
41 # Cleanup any variables that could otherwise clutter up the namespace.
42 del atexit, info, os, pdb, readline, rlcompleter, savehist, sys