Setup: Redirect exceptions properly by overriding sys.excepthook

This commit is contained in:
Manuel Cortez 2020-05-01 13:03:13 -05:00
parent 9d59ee9d8d
commit 92564d4075
2 changed files with 10 additions and 2 deletions

View File

@ -35,3 +35,11 @@ error_handler = logging.FileHandler(os.path.join(paths.logs_path(), ERROR_LOG_FI
error_handler.setFormatter(formatter)
error_handler.setLevel(logging.ERROR)
logger.addHandler(error_handler)
def handle_exception(exc_type, exc_value, exc_traceback):
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))
sys.excepthook = handle_exception

View File

@ -40,9 +40,9 @@ build_exe_options = dict(
build_exe="dist",
optimize=1,
include_msvcr=True,
zip_include_packages=["accessible_output2", "sound_lib", "arrow"],
# zip_include_packages=["accessible_output2", "sound_lib", "arrow"],
replace_paths = [("*", "")],
include_files=["icon.ico", "conf.defaults", "app-configuration.defaults", "keymaps", "locales", "sounds", "documentation", ("keys\lib", "keys"), find_sound_lib_datafiles(), find_accessible_output2_datafiles()]+get_architecture_files(),
include_files=["icon.ico", "conf.defaults", "app-configuration.defaults", "keymaps", "locales", "sounds", "documentation", ("keys/lib", "keys/lib"), ["../windows-dependencies/dictionaries", "dictionaries"], find_sound_lib_datafiles(), find_accessible_output2_datafiles()]+get_architecture_files(),
packages=["wxUI"],
)