コード例 #1
0
ファイル: __init__.py プロジェクト: pyload/pyload
def excepthook(exc_type, exc_value, exc_traceback):
    if issubclass(exc_type, KeyboardInterrupt):
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return
    msg_list = traceback.format_exception_only(exc_type, exc_value)
    exc_info = (exc_type, exc_value, exc_traceback)
    exc_logger.exception(msg_list[-1], exc_info=exc_info)
コード例 #2
0
ファイル: autodebug.py プロジェクト: kdart/pycopia3
 def debugger_hook(exc, value, tb):
     if (not hasattr(sys.stderr, "isatty") or
         not sys.stderr.isatty() or exc in (SyntaxError, IndentationError, KeyboardInterrupt)):
         sys.__excepthook__(exc, value, tb)
     else:
         from pycopia.fepy import debugger
         debugger.post_mortem(tb, exc, value)
コード例 #3
0
ファイル: main.py プロジェクト: Hank-wood/Graduate
    def handle_exception(exc_type, exc_value, exc_traceback):
        if issubclass(exc_type, KeyboardInterrupt):
            sys.__excepthook__(exc_type, exc_value, exc_traceback)
            return

        logger.critical("Uncaught exception",
                        exc_info=(exc_type, exc_value, exc_traceback))
コード例 #4
0
def info(type, value, tb):
    if hasattr(sys, 'ps1') or not sys.stderr.isatty():
        sys.__excepthook__(type, value, tb)
    else:
        import ipdb
        traceback.print_exception(type, value, tb)
        ipdb.post_mortem(tb)
コード例 #5
0
ファイル: logSetup.py プロジェクト: GDXN/MangaCMS
def exceptHook(exc_type, exc_value, exc_traceback):
	if issubclass(exc_type, KeyboardInterrupt):
		sys.__excepthook__(exc_type, exc_value, exc_traceback)
		return
	mainLogger = logging.getLogger("Main")			# Main logger
	mainLogger.critical('Uncaught exception!')
	mainLogger.critical("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
コード例 #6
0
ファイル: imapbackup.py プロジェクト: rcarmo/imapbackup
def cli_exception(typ, value, traceback):
  """Handle CTRL-C by printing newline instead of ugly stack trace"""
  if not issubclass(typ, KeyboardInterrupt):
    sys.__excepthook__(typ, value, traceback)
  else:
    sys.stdout.write("\n")
    sys.stdout.flush()
コード例 #7
0
ファイル: main.py プロジェクト: asacopeich/live-installer
def uncaught_excepthook(*args):
    sys.__excepthook__(*args)
    if __debug__:
        from pprint import pprint
        from types import BuiltinFunctionType, ClassType, ModuleType, TypeType
        tb = sys.last_traceback
        while tb.tb_next: tb = tb.tb_next
        print('\nDumping locals() ...')
        pprint({k:v for k,v in tb.tb_frame.f_locals.items()
                    if not k.startswith('_') and
                       not isinstance(v, (BuiltinFunctionType,
                                          ClassType, ModuleType, TypeType))})
        if sys.stdin.isatty() and (sys.stdout.isatty() or sys.stderr.isatty()):
            try:
                import ipdb as pdb  # try to import the IPython debugger
            except ImportError:
                import pdb as pdb
            print '\nStarting interactive debug prompt ...'
            pdb.pm()
    else:
        import traceback
        from dialogs import ErrorDialog
        ErrorDialog(_('Unexpected error'),
                    _('<b>The installer has failed with the following unexpected error. Please submit a bug report!</b>'),
                    '<tt>' + '\n'.join(traceback.format_exception(*args)) + '</tt>')
    sys.exit(1)
コード例 #8
0
def excepthook(exc_type, exc_value, exc_tb):
    if issubclass(exc_type, subprocess.CalledProcessError):
        sys.exit(exc_value.returncode)
    elif issubclass(exc_type, KeyboardInterrupt):
        sys.exit(128 + signal.SIGINT)
    else:
        sys.__excepthook__(exc_type, exc_value, exc_tb)
コード例 #9
0
ファイル: debug.py プロジェクト: ahri/financials
def debug_exceptions(type, value, tb):
    base_name = "dump"

    # find a browser object in the stack
    frames = inspect.getinnerframes(tb)
    frames.reverse() # reversed because we want the innermost first
    browser = None
    for frame, _, _, _, _, _ in frames:
        for v in inspect.getargvalues(frame).locals.values():
            if isinstance(v, Browser):
                browser = v
                break

    localest = frames[0][0]

    # stick a trace in a file
    with open(base_name + '.trace', 'w') as tracefile:
        tracefile.write("Locals:\n")
        pprint(localest.f_locals, tracefile)
        tracefile.write("\n")
        if browser is not None:
            tracefile.write("URL: %s\n" % browser.url)
            tracefile.write("\n")
        traceback.print_tb(tb, file=tracefile)

    if browser is not None:
        browser.save(base_name + '.html')

    # then call the default handler
    sys.__excepthook__(type, value, tb)
コード例 #10
0
def excepthook(type, value, traceback):
    message, program = format_message(type, value, traceback)
    write_to_log(message)
    mail_message(message, program)

    # Run original exception hook
    sys.__excepthook__(type, value, traceback)
コード例 #11
0
 def write_to_file(exc_type, exc, tb):
     sys.__excepthook__(exc_type, exc, tb)
     fn = "yt_traceback%s" % file_suffix
     with open(fn, "w") as fhandle:
         traceback.print_exception(exc_type, exc, tb, file=fhandle)
         print("Wrote traceback to %s" % fn)
     MPI.COMM_WORLD.Abort(1)
コード例 #12
0
ファイル: main.py プロジェクト: SolydXK/live-installer-3
def uncaught_excepthook(*args):
    sys.__excepthook__(*args)
    if __debug__:
        from pprint import pprint
        from types import BuiltinFunctionType, ClassType, ModuleType, TypeType
        tb = sys.last_traceback
        while tb.tb_next: tb = tb.tb_next
        print(('\nDumping locals() ...'))
        pprint({k:v for k,v in tb.tb_frame.f_locals.items()
                    if not k.startswith('_') and
                       not isinstance(v, (BuiltinFunctionType,
                                          ClassType, ModuleType, TypeType))})
        if sys.stdin.isatty() and (sys.stdout.isatty() or sys.stderr.isatty()):
            can_debug = False
            try:
                import ipdb as pdb  # try to import the IPython debugger
                can_debug = True
            except ImportError:
                try:
                    import pdb as pdb
                    can_debug = True
                except ImportError:
                    pass

            if can_debug:
                print(('\nStarting interactive debug prompt ...'))
                pdb.pm()
    else:
        import traceback
        details = '\n'.join(traceback.format_exception(*args)).replace('<', '').replace('>', '')
        title = 'Unexpected error'
        msg = 'The installer has failed with the following unexpected error. Please submit a bug report!'
        ErrorDialog(title, "<b>%s</b>" % msg, "<tt>%s</tt>" % details, None, True, 'live-installer-3')

    sys.exit(1)
コード例 #13
0
ファイル: new_language.py プロジェクト: amrali/bits
 def exch(e, v, tb):
     if e == NameError:
         token = v.args[0].split("'")[1]
         globals()[token] = 0
         print('worked:', token);
         goto.jump_to(tb.tb_next.tb_lineno + 1, tb.tb_next.tb_frame)
     sys.__excepthook__(e, v, tb)
コード例 #14
0
ファイル: debug.py プロジェクト: ANZ-bank/Sysl
def _hook(type_, value, tback):
    """Exception hook callback."""
    if hasattr(sys, 'ps1') or not sys.stderr.isatty():
        # we are in interactive mode or we don't have a tty-like
        # device, so we call the default hook
        sys.__excepthook__(type_, value, tback)
    else:
        import traceback
        import pdb
        # we are NOT in interactive mode, print the exception...
        traceback.print_exception(type_, value, tback)

        # Dirty hack because Py27 doesn't chain exceptions
        if value.args:
            tb2 = value.args[-1]
            if isinstance(tb2, type(tback)):
                ex = value.args[-2]
                print >>sys.stderr, '{}Caused by{} '.format(
                    ansi('1;35m'), ansi('0m')),
                traceback.print_exception(type_(ex), ex, tb2)

            print
        # ...then start the debugger in post-mortem mode.
        # pdb.pm() # deprecated
        pdb.post_mortem(tback)  # more "modern"
コード例 #15
0
ファイル: global_except_hook.py プロジェクト: asi1024/chainer
def _global_except_hook(exctype, value, traceback):
    """Catches an unhandled exception and call MPI_Abort()."""
    try:
        if _orig_except_hook:
            _orig_except_hook(exctype, value, traceback)
        else:
            sys.__excepthook__(exctype, value, traceback)

    finally:
        import mpi4py.MPI
        rank = mpi4py.MPI.COMM_WORLD.Get_rank()
        sys.stderr.write('\n')
        sys.stderr.write('******************************************\n')
        sys.stderr.write('ChainerMN: \n')
        sys.stderr.write('   Uncaught exception on rank {}. \n'.format(rank))
        sys.stderr.write('   Calling MPI_Abort() to shut down MPI...\n')
        sys.stderr.write('******************************************\n')
        sys.stderr.write('\n\n')
        sys.stderr.flush()

        try:
            import mpi4py.MPI
            mpi4py.MPI.COMM_WORLD.Abort(1)
        except Exception as e:
            # Something is completely broken...
            # There's nothing we can do any more
            sys.stderr.write(
                'Sorry, failed to stop MPI and the process may hang.\n')
            sys.stderr.flush()
            raise e
コード例 #16
0
    def exception_handler(self, etype, evalue, tb):
        """
        Catches crashes/ un-caught exceptions. Creates and attempts to upload the crash reports. Calls the default
        exception handler (sys.__except_hook__) upon completion.

        :param etype: Exception type
        :param evalue: Exception value
        :param tb: Traceback
        :return:
        """
        if CrashReporter.active:
            if etype:
                self.etype = etype
                self.evalue = evalue
                self.tb = tb
                self.tb_info = analyze_traceback(tb)
                # Save the offline report. If the upload of the report is successful, then delete the report.
                report_path = self._save_report()
                great_success = False
                if self._smtp is not None:
                    # Send the report via email
                    with open(report_path, 'r') as _cr:
                        body = _cr.read()
                    great_success |= self._sendmail(self.subject(), body, self.attachments(), html=self.html)
                if self._ftp is not None:
                    # Send the report via FTP
                    great_success |= self._ftp_submit(report_path)
                if great_success:  # Very nice..
                    os.remove(report_path)
            else:
                self.logger.info('CrashReporter: No crashes detected.')

        # Call the default exception hook
        sys.__excepthook__(etype, evalue, tb)
コード例 #17
0
ファイル: socketPython.py プロジェクト: born2net/raspberry
def myexcepthook(exctype, value, traceback):
    if exctype == KeyboardInterrupt:
        socket.close()
        exi()
        print "Handler code goes here"
    else:
        sys.__excepthook__(exctype, value, traceback)
コード例 #18
0
ファイル: environ.py プロジェクト: TheTincho/nemu
def _custom_hook(tipe, value, traceback): # pragma: no cover
    """Custom exception hook, to print nested exceptions information."""
    if hasattr(value, "child_traceback"):
        sys.stderr.write("Nested exception, original traceback " +
                "(most recent call last):\n")
        sys.stderr.write(value.child_traceback + ("-" * 70) + "\n")
    sys.__excepthook__(tipe, value, traceback)
コード例 #19
0
ファイル: app.py プロジェクト: matt-land/mu
def excepthook(*exc_args):
    """
    Log exception and exit cleanly.
    """
    logging.error('Unrecoverable error', exc_info=(exc_args))
    sys.__excepthook__(*exc_args)
    sys.exit(1)
コード例 #20
0
def log_exception(exc_type, exc_value, exc_traceback):
    # http://stackoverflow.com/a/16993115/2954547
    if issubclass(exc_type, KeyboardInterrupt):
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return
    logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
    raise exc_type(exc_value).with_traceback(exc_traceback)
コード例 #21
0
ファイル: cli.py プロジェクト: lory87/lancet
            def exception_handler(type, value, traceback):
                settings_diff = diff_config(
                    load_config(DEFAULT_CONFIG, defaults=False),
                    config,
                    exclude=set([
                        ('lancet', 'sentry_dsn'),
                    ])
                )

                sys.__excepthook__(type, value, traceback)

                if type in IGNORED_EXCEPTIONS:
                    return

                click.echo()
                hr(fg='yellow')

                click.secho('\nAs requested, I am sending details about this '
                            'error to Sentry, please report the following ID '
                            'when seeking support:')

                error_id = sentry_client.captureException(
                    (type, value, traceback),
                    extra={
                        'settings': as_dict(settings_diff),
                        'working_dir': os.getcwd(),
                    },
                )[0]
                click.secho('\n    {}\n'.format(error_id), fg='yellow')
コード例 #22
0
ファイル: log.py プロジェクト: simonjbeaumont/xapi-storage
def handle_unhandled_exceptions(exception_type, exception_value, exception_traceback):
    if not issubclass(exception_type, KeyboardInterrupt):
        if issubclass(exception_type, xapi.XenAPIException):
            info("Returned exception to XAPI", exc_info=(exception_type, exception_value, exception_traceback))
        else:
            error("Unhandled exception", exc_info=(exception_type, exception_value, exception_traceback))
    sys.__excepthook__(exception_type, exception_value, exception_traceback)
コード例 #23
0
ファイル: exceptionhandler.py プロジェクト: MihailJP/friture
def fileexcepthook(exception_type, exception_value, traceback_object):
    # also call the standard exception handler to have prints on the console
    sys.__excepthook__(exception_type, exception_value, traceback_object)

    separator = '-' * 80
    log_dir = QtCore.QStandardPaths.standardLocations(QtCore.QStandardPaths.AppDataLocation)[0]
    logFile = os.path.join(log_dir, "friture.log")

    versionInfo="Friture " + friture.__versionXXXX__

    timeString = time.strftime("%Y-%m-%d, %H:%M:%S")

    tbinfofile = io.StringIO()
    traceback.print_tb(traceback_object, None, tbinfofile)
    tbinfofile.seek(0)
    tbinfo = tbinfofile.read()
    errmsg = '%s: \n%s' % (str(exception_type), str(exception_value))
    sections = [separator, timeString, separator, errmsg, separator, tbinfo, separator, versionInfo]
    msg = '\n'.join(sections)

    try:
        os.makedirs(log_dir, exist_ok=True)
        with open(logFile, "w") as f:
            f.write(msg)
    except IOError as e:
        print(e)
        pass

    notice = \
        """An unhandled exception occurred. Please report the problem\n"""\
        """on GitHub or via email to <%s>.\n"""\
        """A log has been written to "%s".\n\nError information:\n""" % \
        ("*****@*****.**", logFile)

    return str(notice)+str(msg)
コード例 #24
0
ファイル: modapi.py プロジェクト: CloudVPS/openpanel-opencore
    def run(self):
        try:
            os.chdir(os.path.join("/var/openpanel/conf/staging", self.modname))
        
            self.req = self.getrequest()
        
            if self.req.command == "getconfig":
                self.sendresult(0, "OK", extra=self.getconfig())
                return
            
            if self.req.command == "updateok":
            	if self.updateok(self.fulltree["OpenCORE:Session"]["currentversion"]):
            		self.sendresult(0, "OK")
            	else:
            		self.sendresult(error.ERR_MODULE_UPDATE, "Cannot update")

            workerclass = self.getworkerclass(self.req.classid)
            wrapper = modulecallwrapper(workerclass, self.req)
            worker = getattr(wrapper, self.req.command)
            result = worker()
            self.sendresult(0, "OK", result)
        except:
            try:
                self.sendresult(error.ERR_MODULE_FAILURE, ''.join(traceback.format_exception(*sys.exc_info())))
            except:
                sys.__excepthook__(*sys.exc_info())
コード例 #25
0
ファイル: function.py プロジェクト: 625781186/first-test
 def excepthook(type, value, trace):
     try:
         #            auto.press('alt')
         pass
     except:
         pass
     sys.__excepthook__(type, value, trace)
コード例 #26
0
ファイル: pdbtb.py プロジェクト: CxAalto/verkko
def run(func, *args, **kwargs):
    """pdb hook: invokes pdb on exceptions in python.

    The function func is called, with arguments args and
    kwargs=kwargs.  If this func raises an exception, pdb is invoked
    on that frame.  Upon exit from pdb, return to python normally."""
    # save history
    old_hist = _get_history()
    old_hist_start = readline.get_current_history_length()+1

    try:
        return func(*args, **kwargs)
    except Exception as e:
        _add_history(_run_history)


        t, value, tb = sys.exc_info()
        sys.__excepthook__(t, value, tb)
        frame = sys.exc_info()[2]
        #tb = e.tb_frame
        pdb.post_mortem(tb)
        del frame   # the docs warn to avoid circular references.
        del t, value, tb

        _run_history[:] = _get_history(first=old_hist_start)
    readline.clear_history()
    _restore_history(old_hist)
    print old_hist
コード例 #27
0
def unhandled_exception_handler(exc_type, exc_value, exc_traceback):
    if current_thread().name != 'MainThread':
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return

    exception_info = {}

    frame = wx.GetApp().GetTopWindow()

    #exception_info['version'] = wx.GetApp.Version

    exception_info['traceback'] = ''.join(traceback.format_exception(
            exc_type, exc_value, exc_traceback))

    exception_info['config'] = pprint.pformat(config)
    exception_info['flamepath'] = pprint.pformat(
            getattr(frame, 'flamepath', '<not set>'))

    exception_info['platform'] = sys.platform

    exception_info['UserParametersDir'] = wx.GetApp().UserParametersDir
    exception_info['RendersDir'] = wx.GetApp().RendersDir
    exception_info['UserScriptsDir'] = wx.GetApp().UserScriptsDir
    exception_info['ConfigDir'] = wx.GetApp().ConfigDir
    exception_info['Frozen'] = wx.GetApp().Frozen
    exception_info['AppBaseDir'] = wx.GetApp().AppBaseDir
    exception_info['IconsDir'] = wx.GetApp().IconsDir

    msg = """Error:
%(traceback)s

Platform: %(platform)s


Config: 
%(config)s

Flame Path:
%(flamepath)s

UserParametersDir: %(UserParametersDir)s
RendersDir: %(RendersDir)s
UserScriptsDir: %(UserScriptsDir)s
ConfigDir: %(ConfigDir)s
Frozen: %(Frozen)s
AppBaseDir: %(AppBaseDir)s
IconsDir: %(IconsDir)s
""" % exception_info

    print msg

    dlg = ExceptionDialog(frame, exc_type, exc_value, exception_info, msg)
    rv = dlg.ShowModal()
    dlg.Destroy()

    # Pass it on to python to crash or not
    sys.__excepthook__(exc_type, exc_value, exc_traceback)

    if rv == wx.ID_EXIT:
        sys.exit(1)
コード例 #28
0
ファイル: cli.py プロジェクト: GaretJax/lancet
            def exception_handler(type, value, traceback):
                settings_diff = diff_config(
                    load_config(DEFAULT_CONFIG, defaults=False),
                    config,
                    exclude=set([("lancet", "sentry_dsn")]),
                )

                sys.__excepthook__(type, value, traceback)

                if type in IGNORED_EXCEPTIONS:
                    return

                click.echo()
                hr(fg="yellow")

                click.secho(
                    "\nAs requested, I am sending details about this "
                    "error to Sentry, please report the following ID "
                    "when seeking support:"
                )

                exc_info = (type, value, traceback)
                event, hint = event_from_exception(
                    exc_info, client_options=sentry_client.options
                )
                event.setdefault("extra", {}).update(
                    {
                        "settings": as_dict(settings_diff),
                        "working_dir": os.getcwd(),
                    }
                )
                error_id = sentry_client.capture_event(event, hint=hint)
                click.secho("\n    {}\n".format(error_id), fg="yellow")
コード例 #29
0
def uncaught_excepthook(*args):
    sys.__excepthook__(*args)
    if __debug__:
        from pprint import pprint
        from types import BuiltinFunctionType, ClassType, ModuleType, TypeType
        tb = sys.last_traceback
        while tb.tb_next: tb = tb.tb_next
        print('\nDumping locals() ...')
        pprint({k:v for k,v in tb.tb_frame.f_locals.items()
                    if not k.startswith('_') and
                       not isinstance(v, (BuiltinFunctionType,
                                          ClassType, ModuleType, TypeType))})
        if sys.stdin.isatty() and (sys.stdout.isatty() or sys.stderr.isatty()):
            try:
                import ipdb as pdb  # try to import the IPython debugger
            except ImportError:
                import pdb as pdb
            print('\nStarting interactive debug prompt ...')
            pdb.pm()
    else:
        import traceback
        title = _('Unexpected error')
        msg = _('Debian Plymouth Manager has failed with the following unexpected error.\nPlease submit a bug report!')
        msg = "<b>{}</b>\n\n<tt>{}</tt>".format(msg, '\n'.join(traceback.format_exception(*args)))
        showMsg(title, msg)
    sys.exit(1)
コード例 #30
0
ファイル: main.py プロジェクト: hawesie/morse
def morse_excepthook(*args, **kwargs):
    logger.error("[ERROR][MORSE] Uncaught exception, quit Blender.", exc_info = tuple(args))
    # call default python exception hook
    # on Ubuntu/Python3.4 sys.excepthook is overriden by `apport_excepthook`
    sys.__excepthook__(*args, **kwargs)
    import os
    os._exit(-1)
コード例 #31
0
def handle_exception(exc_type, exc_value, exc_traceback):
    """Exception handler to log any uncaught exceptions"""
    logging.error("Uncaught exception",
                  exc_info=(exc_type, exc_value, exc_traceback))
    sys.__excepthook__(exc_type, exc_value, exc_traceback)
コード例 #32
0
ファイル: worker.py プロジェクト: wuhongsong/teuthology
 def log_exception(exc_type, exc_value, exc_traceback):
     if not issubclass(exc_type, KeyboardInterrupt):
         log.critical("Uncaught exception",
                      exc_info=(exc_type, exc_value, exc_traceback))
     sys.__excepthook__(exc_type, exc_value, exc_traceback)
コード例 #33
0
def except_hook(cls, exception, traceback):
    sys.__excepthook__(cls, exception, traceback)
コード例 #34
0
ファイル: daemon.py プロジェクト: eldargashimov/nuxGashColab
def excepthook(type, value, traceback):
    sys.__excepthook__(type, value, traceback)
    logging.critical('Crash! Killing all miners.')
    os.killpg(os.getpgid(0), signal.SIGKILL)  # (This also kills us.)
コード例 #35
0
def exception_hook(self, type, value, trace):
	""""""
	message = get_exception_info(type, value, trace)
	logger.critical(message)
	sys.__excepthook__(type, value, trace)
	sys.exit(-1)
コード例 #36
0
def _ansible_excepthook(exc_type, exc_value, tb):
    # Using an exception allows us to catch it if the calling code knows it can recover
    if issubclass(exc_type, AnsibleModuleError):
        module.fail_json(**exc_value.results)
    else:
        sys.__excepthook__(exc_type, exc_value, tb)
コード例 #37
0
 def testExceptionHook(type, value, tback):
     self.no_exceptions = False
     self.exception_info = (type, value, tback)
     sys.__excepthook__(type, value, tback)
コード例 #38
0
ファイル: gui.py プロジェクト: frankenjoe/pandasgui
import os
import pkg_resources
import pandas as pd
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from pandasgui.widgets import PivotDialog, ScatterDialog
from pandasgui.widgets import DataFrameExplorer
from pandasgui.widgets import FindToolbar
from pandasgui.widgets import HeaderWidget
from pandasgui.utility import fix_ipython

# This makes it so PyQt5 windows don't become unresponsive in IPython outside app._exec() loops
fix_ipython()

# Provides proper stacktrace if PyQt crashes
sys.excepthook = lambda cls, exception, traceback: sys.__excepthook__(
    cls, exception, traceback)

# Holds references to all created PandasGUI windows so they don't get garbage collected
instance_list = []


class PandasGUI(QtWidgets.QMainWindow):
    def __init__(self, **kwargs):
        """
        Args:
            **kwargs (): Dict of (key, value) pairs of
                         {'DataFrame name': DataFrame object}


        self.df_dicts is a dictionary of all dataframes in the GUI.
        {dataframe name: objects}
コード例 #39
0
ファイル: __init__.py プロジェクト: woju/qubes-stats
def excepthook(exctype, value, traceback):
    logging.exception('exception')
    return sys.__excepthook__(exctype, value, traceback)
コード例 #40
0
            self.browser2.hide()
            self.lab_selected.hide()

    def _chClicked(self, evt, ch):
        if ch != self._old:
            self._update(self._old, ch)
            self._old = ch
        ch._mousePressEvent(evt)

    def show(self):
        super().show()
        if self.gui is not None:
            self._decorateCurrentTab()

    def hide(self):
        super().hide()
        self._decorateCurrentTab()

if __name__ == '__main__':
    import sys
    #######################
    # temporary fix: app crack doesnt through exception
    # https://stackoverflow.com/questions/38020020/pyqt5-app-exits-on-error-where-pyqt4-app-would-not
    sys.excepthook = lambda t, v, b: sys.__excepthook__(t, v, b)
    #######################
    app = QtWidgets.QApplication([])
    w = Help(None)

    w.show()
    app.exec_()
コード例 #41
0
 def _earlyExceptionHandler(ty, value, traceback):
     util.ipmi_report(constants.IPMI_FAILED)
     util.vtActivate(1)
     return sys.__excepthook__(ty, value, traceback)
コード例 #42
0
def excepthook(exc_type, exc_value, exc_traceback):

    if issubclass(exc_type, ErrorMessage):
        _ = sys.stderr.write("{}\n".format(exc_value))
    else:
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
コード例 #43
0
def default_sys_except_hook(cls, exception, traceback):
    sys.__excepthook__(cls, exception, traceback)
コード例 #44
0
 def on_close(self):
     Exception_Window._active_window = None
     sys.__excepthook__(*self.exc_args)
     self.close()
コード例 #45
0
def no_abort(a, b, c):
    sys.__excepthook__(a, b, c)
コード例 #46
0
 def excepthook(exctype, value, traceback):
     if issubclass(exctype, Exception):
         client.captureException(exc_info=(exctype, value, traceback))
     sys.__excepthook__(exctype, value, traceback)
コード例 #47
0
def exceptionhandler(exctype, value, traceback):
    if exctype == IndexError:
        parser.print_usage()
    else:
        sys.__excepthook__(exctype, value, traceback)
コード例 #48
0
ファイル: __main__.py プロジェクト: vanthaiunghoa/wdb
 def wdb_pm(xtype, value, traceback):
     sys.__excepthook__(xtype, value, traceback)
     wdb = Wdb.get()
     wdb.reset()
     wdb.interaction(None, traceback, post_mortem=True)
コード例 #49
0
ファイル: dAbot.py プロジェクト: theothersophie/dAbot
def except_hook(type, value, traceback):
    sys.__excepthook__(type, value, traceback)
    input('Press any key to exit...\n')
コード例 #50
0
def error_excepthook(exctype, value, traceback):
    print 'ERROR:'
    sys.__excepthook__(exctype, value, traceback)
コード例 #51
0
def except_hook(cls, exception, traceback):
    """
    Отображение исключений
    """
    sys.__excepthook__(cls, exception, traceback)
コード例 #52
0
ファイル: Many.py プロジェクト: jeromebelleman/many
def excepthook(type, value, tback):
    logging.error('Line %d, %s: %s', tback.tb_lineno, type, value)
    sys.__excepthook__(type, value, tback)
コード例 #53
0
def handle_exception(exc_type, exc_value, exc_traceback):
    if issubclass(exc_type, KeyboardInterrupt):
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return
    logger.debug("Uncaught exception",
                 exc_info=(exc_type, exc_value, exc_traceback))
コード例 #54
0
ファイル: holmos_pc_ui.py プロジェクト: loyalhow/holmos-rpi
 def except_hook(cls, exception, traceback):
     # PyQt5 has changed how it handles exceptions, this restores printing traceback to IDEs
     # https://stackoverflow.com/questions/33736819/pyqt-no-error-msg-traceback-on-exit
     sys.__excepthook__(cls, exception, traceback)
     exit()
コード例 #55
0
ファイル: mpi.py プロジェクト: AizhanAkh/fishchips-Changes
def cleanup(type, value, traceback):
    sys.__excepthook__(type, value, traceback)
    MPI.COMM_WORLD.Abort(1)
コード例 #56
0
def myexcepthook(exctype, value, traceback):
    if exctype == ProcessCanceled:
        logger.info("User cancelled operation")
    else:
        sys.__excepthook__(exctype, value, traceback)
コード例 #57
0
 def excepthook(self, type, value, trace):
     self._logger.error(u"An unhandled exception occured.",
                        exc_info=(type, value, trace))
     sys.__excepthook__(type, value, trace)
コード例 #58
0
ファイル: handler.py プロジェクト: clark3493/pygui
def print_error(exc_type, exc_value, exc_traceback, *args):
    if any(issubclass(exc_type, c) for c in ALWAYS_RAISE):
        # let the system handle important exceptions
        sys.__excepthook__(*args)
    sys.stderr.write(traceback.format_exc())
コード例 #59
0
 def handler(t, value, traceback):
     if self.args.verbose:
         sys.__excepthook__(t, value, traceback)
     else:
         print value
コード例 #60
0
 def handle_exc(self, type, value, traceback):
     self.broker.produce(
         self.client.build_msgpack_event_data(type, traceback, self.tree),
         "event")
     sys.__excepthook__(type, value, traceback)