Exemplo n.º 1
0
    def pudb(line):
        """
        Debug a script (like %run -d) in the IPython process, using PuDB.

        Usage:

        %pudb test.py [args]
            Run script test.py under PuDB.

        """

        # Get the running instance

        if not line.strip():
            print(pudb.__doc__)
            return

        from IPython.utils.process import arg_split
        args = arg_split(line)

        path = os.path.abspath(args[0])
        args = args[1:]
        if not os.path.isfile(path):
            from IPython.core.error import UsageError
            raise UsageError("%%pudb: file %s does not exist" % path)

        from pudb import runscript
        runscript(path, args)
Exemplo n.º 2
0
def pudb_f_v11(self, arg):
    """ Debug a script (like %run -d) in IPython process, using PuDB.

    This conforms to IPython version 0.11

    Usage:

    %pudb test.py [args]
        Run script test.py under PuDB.
    """

    # Get the running instance

    if not arg.strip():
        print __doc__
        return

    from IPython.utils.process import arg_split
    args = arg_split(arg)

    path = os.path.abspath(args[0])
    args = args[1:]
    if not os.path.isfile(path):
        from IPython.core.error import UsageError
        raise UsageError("%%pudb: file %s does not exist" % path)

    from pudb import runscript
    runscript(path, args)
Exemplo n.º 3
0
def pudb_f_v10(self, arg):
    """ Debug a script (like %run -d) in IPython process, using PuDB.

    This conforms to IPython version 0.10

    Usage:

    %pudb test.py [args]
        Run script test.py under PuDB.
    """

    if not arg.strip():
        print __doc__
        return

    from IPython.genutils import arg_split
    args = arg_split(arg)

    path = os.path.abspath(args[0])
    args = args[1:]
    if not os.path.isfile(path):
        raise IPython.ipapi.UsageError("%%pudb: file %s does not exist" % path)

    from pudb import runscript
    ip.IP.history_saving_wrapper(lambda: runscript(path, args))()
Exemplo n.º 4
0
    def pudb(line):
        """
        Debug a script (like %run -d) in the IPython process, using PuDB.

        Usage:

        %pudb test.py [args]
            Run script test.py under PuDB.

        """

        # Get the running instance

        if not line.strip():
            print(pudb.__doc__)
            return

        from IPython.utils.process import arg_split

        args = arg_split(line)

        path = os.path.abspath(args[0])
        args = args[1:]
        if not os.path.isfile(path):
            from IPython.core.error import UsageError

            raise UsageError("%%pudb: file %s does not exist" % path)

        from pudb import runscript

        runscript(path, args)
Exemplo n.º 5
0
def ipy_trepan(self, args):
    '''Call the trepan debugger.'''
    sys_argv = ['cli.py'] + arg_split(args)
    dbg = Debugger()

    # This is broken. For now I'd rather switch than fight it.
    # __IPYTHON__.history_saving_wrapper(trepan.cli.main(sys_argv=argv))()
    trepan.cli.main(dbg, sys_argv)
    return
Exemplo n.º 6
0
def ipy_trepan(self, args):
    '''Call the trepan debugger.'''
    sys_argv = ['cli.py'] + arg_split(args)
    dbg = Debugger()

    # This is broken. For now I'd rather switch than fight it.
    # __IPYTHON__.history_saving_wrapper(trepan.cli.main(sys_argv=argv))()
    trepan.cli.main(dbg, sys_argv)
    return
Exemplo n.º 7
0
def call_pydb(self, args):
    """Invoke pydb with the supplied parameters."""
    try:
        import pydb
    except ImportError:
        raise ImportError("pydb doesn't seem to be installed.")

    if not hasattr(pydb.pydb, "runv"):
        raise ImportError("You need pydb version 1.19 or later installed.")

    argl = arg_split(args)
    # print argl # dbg
    if len(inspect.getargspec(pydb.runv)[0]) == 2:
        pdb = Debugger.Pdb()
        ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )()
    else:
        ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )()
Exemplo n.º 8
0
def call_pydb(self, args):
    """Invoke pydb with the supplied parameters."""
    try:
        import pydb
    except ImportError:
        raise ImportError("pydb doesn't seem to be installed.")

    if not hasattr(pydb.pydb, "runv"):
        raise ImportError("You need pydb version 1.19 or later installed.")

    argl = arg_split(args)
    # print argl # dbg
    if len(inspect.getargspec(pydb.runv)[0]) == 2:
        pdb = Debugger.Pdb(color_scheme=self.rc.colors)
        ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )()
    else:
        ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )()