當前位置: 首頁>>代碼示例>>Python>>正文


Python GUI.showexception方法代碼示例

本文整理匯總了Python中GUI.showexception方法的典型用法代碼示例。如果您正苦於以下問題:Python GUI.showexception方法的具體用法?Python GUI.showexception怎麽用?Python GUI.showexception使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GUI的用法示例。


在下文中一共展示了GUI.showexception方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handle_exception

# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import showexception [as 別名]
    def handle_exception(self, exc_type, exc_value, exc_traceback):
        global config

        traceback_stream = StringIO.StringIO()
        traceback.print_exception(exc_type, exc_value, exc_traceback, None, traceback_stream)
        traceback_stream.seek(0)

        try:
            # don't send to stderr here (original exception handler does it)
            logger.removeHandler(log_handler_stderr)
            removed_stderr = True
        except:
            removed_stderr = False

        logger.critical(traceback_stream.read())

        if removed_stderr:
            logger.addHandler(log_handler_stderr)

        if config is not None:
            if config.VISIONEGG_GUI_ON_ERROR and config.VISIONEGG_TKINTER_OK:
                # Should really check if any GUI windows are open and only do this then

                # close any open screens
                if hasattr(config, "_open_screens"):
                    for screen in config._open_screens:
                        screen.close()

                traceback_stream = StringIO.StringIO()
                traceback.print_tb(exc_traceback, None, traceback_stream)
                traceback_stream.seek(0)

                pygame_bug_workaround = False  # do we need to workaround pygame bug?
                if hasattr(config, "_pygame_started"):
                    if config._pygame_started:
                        pygame_bug_workaround = True
                if sys.platform.startswith("linux"):  # doesn't affect linux for some reason
                    pygame_bug_workaround = False
                if not pygame_bug_workaround:
                    if hasattr(config, "_Tkinter_used"):
                        if config._Tkinter_used:
                            import GUI

                            GUI.showexception(exc_type, exc_value, traceback_stream.getvalue())

        # continue on with normal exception processing:
        __keep_config__ = config  # bizarre that the exception handler changes our values...
        self.orig_hook(exc_type, exc_value, exc_traceback)
        config = __keep_config__  # but we work around it!
開發者ID:visionegg,項目名稱:visionegg,代碼行數:51,代碼來源:__init__.py


注:本文中的GUI.showexception方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。