6 # Command line history:
7 histfile = os.path.expanduser("~/.pdb_history")
10 readline.read_history_file(histfile)
15 def savehist(histfile=histfile):
19 histfilesize = os.environ.get('HISTFILESIZE') \
20 or os.environ.get('HISTSIZE')
23 histfilesize = int(histfilesize)
27 readline.set_history_length(histfilesize)
28 readline.write_history_file(histfile)
30 atexit.register(savehist)
33 def info(type, value, tb):
34 # return to debugger after fatal exception (Python cookbook 14.5):
39 if hasattr(sys, 'ps1') or not sys.stderr.isatty():
40 sys.__excepthook__(type, value, tb)
41 traceback.print_exception(type, value, tb)
48 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498182
51 pdb.Pdb.complete = rlcompleter.Completer().complete
53 # Cleanup any variables that could otherwise clutter up the namespace.
54 del atexit, info, os, pdb, readline, rlcompleter, savehist, sys