diff --git a/pype/blender/__init__.py b/pype/blender/__init__.py index 8a29917e40..4f52b4168a 100644 --- a/pype/blender/__init__.py +++ b/pype/blender/__init__.py @@ -1,16 +1,10 @@ -import logging -from pathlib import Path import os - -import bpy +import sys +import traceback from avalon import api as avalon from pyblish import api as pyblish -from .plugin import AssetLoader - -logger = logging.getLogger("pype.blender") - PARENT_DIR = os.path.dirname(__file__) PACKAGE_DIR = os.path.dirname(PARENT_DIR) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") @@ -19,9 +13,16 @@ PUBLISH_PATH = os.path.join(PLUGINS_DIR, "blender", "publish") LOAD_PATH = os.path.join(PLUGINS_DIR, "blender", "load") CREATE_PATH = os.path.join(PLUGINS_DIR, "blender", "create") +ORIGINAL_EXCEPTHOOK = sys.excepthook + + +def pype_excepthook_handler(*args): + traceback.print_exception(*args) + def install(): """Install Blender configuration for Avalon.""" + sys.excepthook = pype_excepthook_handler pyblish.register_plugin_path(str(PUBLISH_PATH)) avalon.register_plugin_path(avalon.Loader, str(LOAD_PATH)) avalon.register_plugin_path(avalon.Creator, str(CREATE_PATH)) @@ -29,6 +30,7 @@ def install(): def uninstall(): """Uninstall Blender configuration for Avalon.""" + sys.excepthook = ORIGINAL_EXCEPTHOOK pyblish.deregister_plugin_path(str(PUBLISH_PATH)) avalon.deregister_plugin_path(avalon.Loader, str(LOAD_PATH)) avalon.deregister_plugin_path(avalon.Creator, str(CREATE_PATH)) diff --git a/pype/ftrack/lib/ftrack_app_handler.py b/pype/ftrack/lib/ftrack_app_handler.py index 2b46dd43d8..eebffda280 100644 --- a/pype/ftrack/lib/ftrack_app_handler.py +++ b/pype/ftrack/lib/ftrack_app_handler.py @@ -286,7 +286,9 @@ class AppAction(BaseHandler): # Run SW if was found executable if execfile is not None: - avalonlib.launch(executable=execfile, args=[], environment=env) + popen = avalonlib.launch( + executable=execfile, args=[], environment=env + ) else: return { 'success': False,