phdru.name / Software / dotfiles / python

# This is startup file for interactive python debugger.
#
# Text version here
#
# Generated by gvim :runtime syntax/2html.vim
#

import atexit
import os
import sys
import readline

# Command line history:
histfile = os.path.expanduser("~/.pdb_history")

try:
    readline.read_history_file(histfile)
except IOError:
    pass


def savehist(histfile=histfile):
    import os
    import readline

    histfilesize = os.environ.get('HISTFILESIZE') \
        or os.environ.get('HISTSIZE')
    if histfilesize:
        try:
            histfilesize = int(histfilesize)
        except ValueError:
            pass
        else:
            readline.set_history_length(histfilesize)
    readline.write_history_file(histfile)

atexit.register(savehist)


def info(type, value, tb):
    # return to debugger after fatal exception (Python cookbook 14.5):
    import pdb
    import sys
    import traceback

    if hasattr(sys, 'ps1') or not sys.stderr.isatty():
        sys.__excepthook__(type, value, tb)
    traceback.print_exception(type, value, tb)
    print
    pdb.pm()

sys.excepthook = info


# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498182
import pdb
import rlcompleter
pdb.Pdb.complete = rlcompleter.Completer().complete

# Cleanup any variables that could otherwise clutter up the namespace.
del atexit, info, os, pdb, readline, rlcompleter, savehist, sys

This is the page http://phdru.name/Software/dotfiles/python/pdbrc.py.html. It was generated on Sun, 15 May 2016 13:41:36 GMT from CheetahTemplate pdbrc.py.tmpl. Some rights are reserved. Read more about technical aspects of the site.