'Handle an error gracefully.  May be overridden.
The default is to print a traceback and continue.'

def handle_error(self, cmdline):

    print >>sys.stderr, ('-' * 40)
    print >>sys.stderr, 'Exception    happened    during    processing    the    command',
    print >>sys.stderr, repr(cmdline)
    import traceback
    traceback.print_exc()
    print >>sys.stderr, ('-' * 40)
