Add exception handling for unsupported schema in OTIO file. Improve error message and version requirement.

This commit is contained in:
Jakub Jezek 2024-05-28 14:07:22 +02:00
parent 7e26478811
commit 1ae7a22d1d
No known key found for this signature in database
GPG key ID: 06DBD609ADF27FD9

View file

@ -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()