示例#1
0
文件: elt.py 项目: fzvoid/SankomSrc
	def handler(self, exctype, value, traceback):
		#logger.error( "Unhandled exception: ", exc_info=(exctype, value, traceback))		
		#print "Unhandled exception: ", value.message
		#print repr(exctype), value.message		
		self.errorSignal.emit( value.message)
		#sys._excepthook(exctype, value, traceback.format_exc())
		sys._excepthook(exctype, value, traceback)
def customExceptionHook(exctype, value, traceback):
    # Print the error and traceback
    print(exctype, value, traceback)

    # Call the normal Exception hook after
    sys._excepthook(exctype, value, traceback)
    sys.exit(1)
 def handler(self, exctype, value, traceback):
     self.errorSignal.emit()
     sys._excepthook(exctype, value, traceback)
示例#4
0
 def my_exception_hook(exctype, value, traceback):
     # Print the error and traceback
     logger.exception(f"{exctype}, {value}, {traceback}")
     # Call the normal Exception hook after
     sys._excepthook(exctype, value, traceback)
示例#5
0
def exception_hook(exctype, value, traceback):
    """!
    @brief Needed for suppressing traceback silencing in newer version of PyQt5
    """
    sys._excepthook(exctype, value, traceback)
    sys.exit(1)
示例#6
0
 def exception_hook(exctype, value, tb):
     logging.critical(''.join(traceback.format_exception(
         exctype, value, tb)))
     sys._excepthook(exctype, value, tb)
     sys.exit(1)
示例#7
0
 def exception_hook(exctype, value, traceback): # Catches exceptions that QT likes to hide
     print(exctype, value, traceback)
     sys._excepthook(exctype, value, traceback)
     sys.exit(1)
示例#8
0
文件: retina.py 项目: jromang/retina
 def exception_hook(exctype, value, traceback):
     sys._excepthook(exctype, value, traceback)
     time.sleep(10)
     sys.exit(1)
 def my_exception_hook(exctype, value, traceback):
     # Print the error and traceback
     print(exctype, value, traceback)
     # Call the normal Exception hook after
     sys._excepthook(exctype, value, traceback)
     sys.exit(1)
示例#10
0
文件: gulag.py 项目: Mxnuuel/gulag
def _excepthook(type, value, traceback):
    if type is KeyboardInterrupt:
        print('\33[2K\r', end='Aborted startup.')
        return
    print('\x1b[0;31mgulag ran into an issue ' 'before starting up :(\x1b[0m')
    sys._excepthook(type, value, traceback)
示例#11
0
 def exception(exctype, value, traceback):
     # Print the error and traceback
     print(exctype, value, traceback)
     sys._excepthook(exctype, value, traceback)
     sys.exit(1)
示例#12
0
 def excepthook(cls, exception, traceback):
     print(cls, exception, traceback)
     sys._excepthook(cls, exception, traceback)
     sys.exit(1)
示例#13
0
def exception_hook(exctype, value, traceback):
    RPi.GPIO.cleanup()
    print(exctype, value, traceback)
    sys._excepthook(exctype, value, traceback)
    sys.exit(1)
示例#14
0
def exception_hook(exctype, value, traceback):
    sys._excepthook(exctype, value, traceback)
    print("loooooooooooool")
    sys.exit(1)
示例#15
0
文件: main.py 项目: 68Duck/Chess
def my_exception_hook(exctype, value, traceback):
    print(exctype, value, traceback)
    sys._excepthook(exctype, value, traceback)
    sys.exit(1)
示例#16
0
def exception_hook(exctype, value, traceback):
    sys._excepthook(exctype, value, traceback)
    sys.exit(1)
示例#17
0
 def handler(self, exctype, value, traceback):
     self.errorSignal.emit()
     print "ERROR CAPTURED"
     sys._excepthook(exctype, value, traceback)
示例#18
0
 def exception_hook(exctype, value, traceback):
     sys._excepthook(exctype, value, traceback)
     sys.exit(1)
示例#19
0
def main(*args):
    import sys
    if len(args) == 0:
        args = sys.argv
    else:
        args = [sys.executable] + list(args)
    print("args", args)

    if len(args) > 1:
        if args[1] == "register" or args[1] == "install":
            from .includes.RegisterRegistry import install
            return install()
        elif args[1] == "unregister" or args[1] == "uninstall":
            from .includes.RegisterRegistry import install
            return install("uninstall")
        elif args[1] == "-v" or args[1] == "--version":
            import clickpoints
            print(clickpoints.__version__)
            return
        elif args[1] == "ffmpeg":
            import imageio
            import glob
            import os
            # check for ffmpeg
            try:
                # check if imageio already has an exe file
                imageio.plugins.ffmpeg.get_exe()
                print("ffmpeg found from imageio")
            except imageio.core.fetching.NeedDownloadError:
                # try to find an ffmpeg.exe in the ClickPoints folder
                files = glob.glob(
                    os.path.join(os.path.dirname(__file__), "..",
                                 "ffmpeg*.exe"))
                files.extend(
                    glob.glob(
                        os.path.join(os.path.dirname(__file__), "..",
                                     "external", "ffmpeg*.exe")))
                # if an ffmpeg exe has been found, set the environmental variable accordingly
                if len(files):
                    print("ffmpeg found", files[0])
                    os.environ['IMAGEIO_FFMPEG_EXE'] = files[0]
                # if not, try to download it
                else:
                    print("try to download ffmpeg")
                    imageio.plugins.ffmpeg.download()
            return

    from clickpoints import print_status
    # print
    print_status()
    """ some magic to prevent PyQt5 from swallowing exceptions """
    # Back up the reference to the exceptionhook
    sys._excepthook = sys.excepthook
    # Set the exception hook to our wrapping function
    sys.excepthook = lambda *args: sys._excepthook(*args)

    from qtpy import QtCore, QtWidgets, QtGui
    import sys
    import ctypes
    from clickpoints.Core import ClickPointsWindow
    from clickpoints.includes import LoadConfig
    import qasync
    import asyncio

    from clickpoints import define_paths

    define_paths()

    app = QtWidgets.QApplication(args)
    loop = qasync.QEventLoop(app)
    asyncio.set_event_loop(loop)
    app.loop = loop

    # set an application id, so that windows properly stacks them in the task bar
    if sys.platform[:3] == 'win':
        myappid = 'fabrybiophysics.clickpoints'  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    # load config and exec addon code
    config = LoadConfig(*args)

    with loop:
        # init and open the ClickPoints window
        window = ClickPointsWindow(config, app)
        window.show()
        loop.run_forever()
示例#20
0
matplotlib.use('agg')
import unittest
import numpy as np

import sys
import mock
import os
from pathlib import Path
import matplotlib.pyplot as plt
from matplotlib import _pylab_helpers
from qtpy import QtCore, QtWidgets, QtGui
""" some magic to prevent PyQt5 from swallowing exceptions """
# Back up the reference to the exceptionhook
sys._excepthook = sys.excepthook
# Set the exception hook to our wrapping function
sys.excepthook = lambda *args: sys._excepthook(*args)


class TestFits(unittest.TestCase):
    def setUp(self):
        self.filename = Path(self.id().split(".")[-1] + ".py")
        with self.filename.open("w") as fp:
            fp.write("""
import matplotlib.pyplot as plt
import numpy as np

# now import pylustrator
import pylustrator

# activate pylustrator
pylustrator.start()
示例#21
0
 def exception_hook(exctype, value, traceback):
     """ Print out any exception and pass it through to the original exception hook. """
     print(exctype, value, traceback)
     sys._excepthook(exctype, value, traceback)
     sys.exit(1)