Improve FusionPreLaunch hook error readability + make it a pop-up from the launcher.

- I've removed the usage of ` in the string as they would convert into special characters in the pop-up. So those are changed to '.
This commit is contained in:
Roy Nieterau 2022-01-09 20:42:40 +01:00
parent 7ecfda3566
commit 1be9a4112a

View file

@ -1,6 +1,6 @@
import os
import importlib
from openpype.lib import PreLaunchHook
from openpype.lib import PreLaunchHook, ApplicationLaunchFailed
from openpype.hosts.fusion.api import utils
@ -14,24 +14,26 @@ class FusionPrelaunch(PreLaunchHook):
def execute(self):
# making sure pyton 3.6 is installed at provided path
py36_dir = os.path.normpath(self.launch_context.env.get("PYTHON36", ""))
assert os.path.isdir(py36_dir), (
"Python 3.6 is not installed at the provided folder path. Either "
"make sure the `environments\resolve.json` is having correctly "
"set `PYTHON36` or make sure Python 3.6 is installed "
f"in given path. \nPYTHON36E: `{py36_dir}`"
if not os.path.isdir(py36_dir):
raise ApplicationLaunchFailed(
"Python 3.6 is not installed at the provided path.\n"
"Either make sure the 'environments/fusion.json' has "
"'PYTHON36' set corectly or make sure Python 3.6 is installed "
f"in the given path.\n\nPYTHON36: {py36_dir}"
)
self.log.info(f"Path to Fusion Python folder: `{py36_dir}`...")
self.log.info(f"Path to Fusion Python folder: '{py36_dir}'...")
self.launch_context.env["PYTHON36"] = py36_dir
# setting utility scripts dir for scripts syncing
us_dir = os.path.normpath(
self.launch_context.env.get("FUSION_UTILITY_SCRIPTS_DIR", "")
)
assert os.path.isdir(us_dir), (
"Fusion utility script dir does not exists. Either make sure "
"the `environments\fusion.json` is having correctly set "
"`FUSION_UTILITY_SCRIPTS_DIR` or reinstall DaVinci Resolve. \n"
f"FUSION_UTILITY_SCRIPTS_DIR: `{us_dir}`"
if not os.path.isdir(us_dir):
raise ApplicationLaunchFailed(
"Fusion utility script dir does not exist. Either make sure "
"the 'environments/fusion.json' has 'FUSION_UTILITY_SCRIPTS_DIR' "
"set correctly or reinstall DaVinci Resolve.\n\n"
f"FUSION_UTILITY_SCRIPTS_DIR: '{us_dir}'"
)
try: