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


Python traceback.print_last方法代码示例

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


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

示例1: system_ls

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def system_ls(path):
	ret = ""
	print ("LS("+path+")")
	try:
		ptr = runCode('(void*)opendir((char*)"'+path+'");')
		if int(ptr,16) == 0:
			return "Cannot find directory"
		print("opendir("+ptr+")")
		while True:
			de = runCode('(void*)readdir((void*)'+ptr+');');
			#print ("readdir()="+de)
			if int(de,16) == 0:
				break
			row = cmd('x/1s '+de+'+0x15')
			print (row.strip())
			ret = ret + row
		runCode('(int)closedir((void*)'+ptr+')')
	except:
		traceback.print_last()
		ret = ret + "ERR\n";
	return ret 
开发者ID:nowsecure,项目名称:r2lldb,代码行数:23,代码来源:dbg.py

示例2: system_ls

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def system_ls(path):
	ret = ""
	print ("LS("+path+")")
	try:
		ptr = runCode('(void*)opendir((char*)"'+path+'");')
		if int(ptr,16) == 0:
			return "Cannot find directory"
		print "opendir("+ptr+")"
		while True:
			de = runCode('(void*)readdir((void*)'+ptr+');');
			#print ("readdir()="+de)
			if int(de,16) == 0:
				break
			row = cmd('x/1s '+de+'+0x15')
			print (row.strip())
			ret = ret + row
		runCode('(int)closedir((void*)'+ptr+')')
	except:
		traceback.print_last()
		ret = ret + "ERR\n";
	return ret 
开发者ID:nowsecure,项目名称:r2lldb,代码行数:23,代码来源:dbg.py

示例3: show

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def show(root=None, debug=False, parent=None):
    """Display Scene Inventory GUI

    Arguments:
        debug (bool, optional): Run in debug-mode,
            defaults to False
        parent (QtCore.QObject, optional): When provided parent the interface
            to this QObject.

    """

    try:
        module.window.close()
        del module.window
    except (RuntimeError, AttributeError):
        pass

    if debug:
        import traceback
        sys.excepthook = lambda typ, val, tb: traceback.print_last()

    with tools_lib.application():
        window = Window(parent)
        window.show()
        window.setStyleSheet(style.load_stylesheet())
        window.refresh()

        module.window = window

        # Pull window to the front.
        module.window.raise_()
        module.window.activateWindow() 
开发者ID:getavalon,项目名称:core,代码行数:34,代码来源:app.py

示例4: __clear_break

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def __clear_break(self, pid, address):
        """
        Used by L{dont_break_at} and L{dont_stalk_at}.

        @type  pid: int
        @param pid: Process global ID.

        @type  address: int or str
        @param address:
            Memory address of code instruction to break at. It can be an
            integer value for the actual address or a string with a label
            to be resolved.
        """
        if type(address) not in (int, long):
            unknown = True
            label = address
            try:
                deferred = self.__deferredBP[pid]
                del deferred[label]
                unknown = False
            except KeyError:
##                traceback.print_last()      # XXX DEBUG
                pass
            aProcess = self.system.get_process(pid)
            try:
                address = aProcess.resolve_label(label)
                if not address:
                    raise Exception()
            except Exception:
##                traceback.print_last()      # XXX DEBUG
                if unknown:
                    msg = ("Can't clear unknown code breakpoint"
                           " at %s in process ID %d")
                    msg = msg % (label, pid)
                    warnings.warn(msg, BreakpointWarning)
                return
        if self.has_code_breakpoint(pid, address):
            self.erase_code_breakpoint(pid, address) 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:40,代码来源:breakpoint.py

示例5: system_cat

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def system_cat(path, head=False):
	ret = ""
	try:
		fd = runCode('(void*)open((char*)"'+path+'",0);')
		print ("FD "+fd)
		if int(fd,16) == 4294967295:
			return "Cannot open file"
		buf = runCode('(void*)malloc((int)10240)')
		print("open("+buf+")")
		i = 0
		while True:
			de = runCode('(int)read((int)'+str(fd)+',(void*)'+str(buf)+',(int)1024);');
			count = int (de, 16)
			print ("read("+str(i)+")="+str(count))
			try:
				data = read(int(buf,16), count)
				ret = ret + str(data)
			except:
				traceback.print_last()
				ret = ret + ".\n"
			if count != 1024 and count != 0x1024:
				break
			if head:
				break
			i = i + 1
	except:
		traceback.print_last()
		ret = ret + "ERR\n";
	cmd('e (void)free((void*)'+buf+')')
	cmd('e (int)close((int)'+fd+')')
	return ret 
开发者ID:nowsecure,项目名称:r2lldb,代码行数:33,代码来源:dbg.py

示例6: system_cat

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def system_cat(path, head=False):
	ret = ""
	try:
		fd = runCode('(void*)open((char*)"'+path+'",0);')
		print ("FD "+fd)
		if int(fd,16) == 4294967295:
			return "Cannot open file"
		buf = runCode('(void*)malloc((int)10240)')
		print "open("+buf+")"
		i = 0
		while True:
			de = runCode('(int)read((int)'+str(fd)+',(void*)'+str(buf)+',(int)1024);');
			count = int (de, 16)
			print ("read("+str(i)+")="+str(count))
			try:
				data = read(int(buf,16), count)
				ret = ret + str(data)
			except:
				traceback.print_last()
				ret = ret + ".\n"
			if count != 1024 and count != 0x1024:
				break
			if head:
				break
			i = i + 1
	except:
		traceback.print_last()
		ret = ret + "ERR\n";
	cmd('e (void)free((void*)'+buf+')')
	cmd('e (int)close((int)'+fd+')')
	return ret 
开发者ID:nowsecure,项目名称:r2lldb,代码行数:33,代码来源:dbg.py

示例7: show

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def show(debug=False, parent=None, use_context=False):
    """Display Loader GUI

    Arguments:
        debug (bool, optional): Run loader in debug-mode,
            defaults to False
        parent (QtCore.QObject, optional): The Qt object to parent to.
        use_context (bool): Whether to apply the current context upon launch

    """

    # Remember window
    if module.window is not None:
        try:
            module.window.show()

            # If the window is minimized then unminimize it.
            if module.window.windowState() & QtCore.Qt.WindowMinimized:
                module.window.setWindowState(QtCore.Qt.WindowActive)

            # Raise and activate the window
            module.window.raise_()             # for MacOS
            module.window.activateWindow()     # for Windows
            module.window.refresh()
            return
        except RuntimeError as exc:
            if not str(exc).rstrip().endswith("already deleted."):
                raise

            # Garbage collected
            module.window = None

    if debug:
        import traceback
        sys.excepthook = lambda typ, val, tb: traceback.print_last()

    with lib.application():

        # TODO: Global state, remove these
        lib.refresh_family_config_cache()
        lib.refresh_group_config_cache()

        window = Window(parent)
        window.show()
        window.setStyleSheet(style.load_stylesheet())

        if use_context:
            context = {"asset": api.Session["AVALON_ASSET"]}
            window.set_context(context, refresh=True)
        else:
            window.refresh()

        module.window = window

        # Pull window to the front.
        module.window.raise_()
        module.window.activateWindow() 
开发者ID:getavalon,项目名称:core,代码行数:59,代码来源:app.py

示例8: show

# 需要导入模块: import traceback [as 别名]
# 或者: from traceback import print_last [as 别名]
def show(debug=False, parent=None):
    """Display asset creator GUI

    Arguments:
        debug (bool, optional): Run loader in debug-mode,
            defaults to False
        parent (QtCore.QObject, optional): When provided parent the interface
            to this QObject.

    """

    if module.window:
        module.window.close()
        del(module.window)

    if debug:
        from avalon import mock
        for creator in mock.creators:
            api.register_plugin(api.Creator, creator)

        import traceback
        sys.excepthook = lambda typ, val, tb: traceback.print_last()

        io.install()

        any_project = next(
            project for project in io.projects()
            if project.get("active", True) is not False
        )

        api.Session["AVALON_PROJECT"] = any_project["name"]
        module.project = any_project["name"]

    with lib.application():
        window = Window(parent)
        window.refresh()
        window.show()
        window.setStyleSheet(style.load_stylesheet())

        module.window = window

        # Pull window to the front.
        module.window.raise_()
        module.window.activateWindow() 
开发者ID:getavalon,项目名称:core,代码行数:46,代码来源:app.py


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