当前位置: 首页>>代码示例>>Python>>正文


Python Pdb.interaction方法代码示例

本文整理汇总了Python中IPython.core.debugger.Pdb.interaction方法的典型用法代码示例。如果您正苦于以下问题:Python Pdb.interaction方法的具体用法?Python Pdb.interaction怎么用?Python Pdb.interaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPython.core.debugger.Pdb的用法示例。


在下文中一共展示了Pdb.interaction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post_mortem

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def post_mortem(tb):
    update_stdout()
    wrap_sys_excepthook()
    p = Pdb(def_colors)
    p.reset()
    if tb is None:
        return
    p.interaction(None, tb)
开发者ID:omergertel,项目名称:ipdb,代码行数:10,代码来源:__main__.py

示例2: post_mortem

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def post_mortem(tb):
    ip = ipapi.get()
    def_colors = ip.colors
    p = Pdb(def_colors)
    p.reset()
    while tb.tb_next is not None:
        tb = tb.tb_next
    p.interaction(tb.tb_frame, tb)
开发者ID:pkimber,项目名称:my-memory,代码行数:10,代码来源:ipdb.py

示例3: post_mortem

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def post_mortem(tb):
    update_stdout()
    wrap_sys_excepthook()
    p = Pdb(def_colors)
    p.reset()
    if tb is None:
        return
    while tb.tb_next is not None:
        tb = tb.tb_next
    p.interaction(tb.tb_frame, tb)
开发者ID:dmsul,项目名称:ipdb,代码行数:12,代码来源:__main__.py

示例4: post_mortem

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def post_mortem(tb):
    update_stdout()
    BdbQuit_excepthook.excepthook_ori = sys.excepthook
    sys.excepthook = BdbQuit_excepthook
    p = Pdb(def_colors)
    p.reset()
    if tb is None:
        return
    while tb.tb_next is not None:
        tb = tb.tb_next
    p.interaction(tb.tb_frame, tb)
开发者ID:moon2l,项目名称:ipdb,代码行数:13,代码来源:__main__.py

示例5: post_mortem

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def post_mortem(tb):
    update_stdout()
    sys.excepthook = lambda et, ev, tb, orig_hook=sys.excepthook: \
      BdbQuit_excepthook(et, ev, tb, orig_hook)
    p = Pdb(def_colors)
    p.reset()
    if tb is None:
        return
    while tb.tb_next is not None:
        tb = tb.tb_next
    p.interaction(tb.tb_frame, tb)
开发者ID:DamianHeard,项目名称:ipdb,代码行数:13,代码来源:__main__.py

示例6: interactive_pdb

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def interactive_pdb():
    """ inspect the traceback of the most recent exception. """
    import traceback
    from IPython.core.debugger import Pdb

    if last_tb is None:
        print("Nothing to debug.")
        return

    # print to stdout (sic!) what this pdb session is about
    msg = traceback.format_tb(last_tb)[-5:]
    print('Starting PDB session for:\n\n\033[94m%s\033[0m\n' % ''.join(msg))

    pdb = Pdb()
    pdb.reset()
    pdb.interaction(frame=None, traceback=last_tb)
开发者ID:Doik,项目名称:micropsi2,代码行数:18,代码来源:tools.py

示例7: main

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def main():
    if not sys.argv[1:] or sys.argv[1] in ("--help", "-h"):
        print "usage: ipdb.py scriptfile [arg] ..."
        sys.exit(2)

    mainpyfile = sys.argv[1]     # Get script filename
    if not os.path.exists(mainpyfile):
        print 'Error:', mainpyfile, 'does not exist'
        sys.exit(1)

    del sys.argv[0]         # Hide "pdb.py" from argument list

    # Replace pdb's dir with script's dir in front of module search path.
    sys.path[0] = os.path.dirname(mainpyfile)

    # Note on saving/restoring sys.argv: it's a good idea when sys.argv was
    # modified by the script being debugged. It's a bad idea when it was
    # changed by the user from the command line. There is a "restart" command
    # which allows explicit specification of command line arguments.
    pdb = Pdb(def_colors)
    while 1:
        try:
            pdb._runscript(mainpyfile)
            if pdb._user_requested_quit:
                break
            print "The program finished and will be restarted"
        except Restart:
            print "Restarting", mainpyfile, "with arguments:"
            print "\t" + " ".join(sys.argv[1:])
        except SystemExit:
            # In most cases SystemExit does not warrant a post-mortem session.
            print "The program exited via sys.exit(). Exit status: ",
            print sys.exc_info()[1]
        except:
            traceback.print_exc()
            print "Uncaught exception. Entering post mortem debugging"
            print "Running 'cont' or 'step' will restart the program"
            t = sys.exc_info()[2]
            pdb.interaction(None, t)
            print "Post mortem debugger finished. The " + mainpyfile + \
                  " will be restarted"
开发者ID:DamianHeard,项目名称:ipdb,代码行数:43,代码来源:__main__.py

示例8: debug_shell

# 需要导入模块: from IPython.core.debugger import Pdb [as 别名]
# 或者: from IPython.core.debugger.Pdb import interaction [as 别名]
def debug_shell(user_ns, user_global_ns, traceback=None, execWrapper=None):
    ipshell = None
    if traceback:
        try:
            from IPython.core.debugger import Pdb
            from IPython.terminal.ipapp import TerminalIPythonApp
            ipapp = TerminalIPythonApp.instance()
            ipapp.interact = False  # Avoid output (banner, prints)
            ipapp.initialize(argv=[])
            def_colors = ipapp.shell.colors
            pdb_obj = Pdb(def_colors)
            pdb_obj.botframe = None  # not sure. exception otherwise at quit
            ipshell = lambda: pdb_obj.interaction(None, traceback=traceback)
        except Exception:
            pass
    if not ipshell:
        try:
            import IPython
            import IPython.terminal.embed
            class DummyMod(object): pass
            module = DummyMod()
            module.__dict__ = user_global_ns
            module.__name__ = "DummyMod"
            ipshell = IPython.terminal.embed.InteractiveShellEmbed(
                user_ns=user_ns, user_module=module)
        except Exception:
            pass
        else:
            if execWrapper:
                old = ipshell.run_code
                ipshell.run_code = lambda code: execWrapper(lambda: old(code))
    if ipshell:
        ipshell()
    else:
        if traceback:
            import pdb
            pdb.post_mortem(traceback)
        else:
            simple_debug_shell(user_global_ns, user_ns)
开发者ID:albertz,项目名称:PyCParser,代码行数:41,代码来源:better_exchook.py


注:本文中的IPython.core.debugger.Pdb.interaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。