From 1ae7a22d1d5abb3659da18f4a6949aebbe66c97f Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 28 May 2024 14:07:22 +0200 Subject: [PATCH] Add exception handling for unsupported schema in OTIO file. Improve error message and version requirement. --- .../plugins/publish/validate_editorial_package.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server_addon/traypublisher/client/ayon_traypublisher/plugins/publish/validate_editorial_package.py b/server_addon/traypublisher/client/ayon_traypublisher/plugins/publish/validate_editorial_package.py index 42755e1396..02793516e2 100644 --- a/server_addon/traypublisher/client/ayon_traypublisher/plugins/publish/validate_editorial_package.py +++ b/server_addon/traypublisher/client/ayon_traypublisher/plugins/publish/validate_editorial_package.py @@ -1,5 +1,7 @@ import os import opentimelineio +from opentimelineio.exceptions import UnsupportedSchemaError + import pyblish.api from ayon_core.pipeline import PublishValidationError @@ -36,7 +38,16 @@ class ValidateEditorialPackage(pyblish.api.InstancePlugin): resource_file_names = {os.path.basename(path) for path in resource_paths} - otio_data = opentimelineio.adapters.read_from_file(otio_path) + try: + otio_data = opentimelineio.adapters.read_from_file(otio_path) + except UnsupportedSchemaError as e: + raise PublishValidationError( + f"Unsupported schema in otio file '{otio_path}'." + "Version of your OpenTimelineIO library is too old." + "Please update it to the latest version." + f"Current version is '{opentimelineio.__version__}', " + "but required is at least 0.16.0." + ) from e target_urls = self._get_all_target_urls(otio_data) missing_files = set()