Open reinecke opened 3 months ago
[x] I believe this isn't a duplicate topic [x] This report is not related to an adapter
[ ] Build problem [x] Incorrect Functionality or bug [ ] New feature or functionality
Setting AnyDictionary or AnyVector values raises a TypeError. All OTIO serializable types should be usable for things like metadata dictionaries.
AnyDictionary
AnyVector
TypeError
metadata
The fix should also test to make sure serialization and deserialization work properly.
Example:
>>> clip = otio.schema.Clip() >>> clip.metadata["box"] = otio.schema.Box2d(otio.schema.V2d(0.0, 0.0), otio.schema.V2d(16.0, 9.0)) Traceback (most recent call last): File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 112, in _value_to_any return PyAny(value) ^^^^^^^^^^^^ TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. opentimelineio._otio.PyAny(arg0: bool) 2. opentimelineio._otio.PyAny(arg0: int) 3. opentimelineio._otio.PyAny(arg0: float) 4. opentimelineio._otio.PyAny(arg0: str) 5. opentimelineio._otio.PyAny(arg0: None) 6. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.SerializableObject) 7. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.RationalTime) 8. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeRange) 9. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeTransform) 10. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyVector) 11. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyDictionary) Invoked with: otio.schema.Box2d(min=otio.schema.V2d(x=0.0, y=0.0), max=otio.schema.V2d(x=16.0, y=9.0)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 175, in __setitem__ self.__internal_setitem__(key, _value_to_any(item)) ^^^^^^^^^^^^^^^^^^^ File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 115, in _value_to_any raise TypeError( TypeError: A value of type '<class 'opentimelineio._otio.Box2d'>' is incompatible with OpenTimelineIO. OpenTimelineIO only supports the following value types in AnyDictionary containers (like the .metadata dictionary): ('int', 'float', 'str', 'bool', 'list', 'dictionary', 'opentime.RationalTime', 'opentime.TimeRange', 'opentime.TimeTransform', 'opentimelineio.core.SerializableObject'). >>> clip.metadata["vector"] = otio.schema.V2d(16.0, 9.0) Traceback (most recent call last): File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 112, in _value_to_any return PyAny(value) ^^^^^^^^^^^^ TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. opentimelineio._otio.PyAny(arg0: bool) 2. opentimelineio._otio.PyAny(arg0: int) 3. opentimelineio._otio.PyAny(arg0: float) 4. opentimelineio._otio.PyAny(arg0: str) 5. opentimelineio._otio.PyAny(arg0: None) 6. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.SerializableObject) 7. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.RationalTime) 8. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeRange) 9. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeTransform) 10. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyVector) 11. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyDictionary) Invoked with: otio.schema.V2d(x=16.0, y=9.0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 175, in __setitem__ self.__internal_setitem__(key, _value_to_any(item)) ^^^^^^^^^^^^^^^^^^^ File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 115, in _value_to_any raise TypeError( TypeError: A value of type '<class 'opentimelineio._otio.V2d'>' is incompatible with OpenTimelineIO. OpenTimelineIO only supports the following value types in AnyDictionary containers (like the .metadata dictionary): ('int', 'float', 'str', 'bool', 'list', 'dictionary', 'opentime.RationalTime', 'opentime.TimeRange', 'opentime.TimeTransform', 'opentimelineio.core.SerializableObject').
OpenTimelineIO: 0.15.0 PyPI Operating System: macOS 13.6.6 Python version if appropriate: Python 3.11.6
d = otio._otio.AnyDictionary() d["vector"] = otio.schema.V2d(16.0, 9.0) d["box"] = otio.schema.Box2d(otio.schema.V2d(0.0, 0.0), otio.schema.V2d(16.0, 9.0)) vec = otio._otio.AnyVector() vec.append(otio.schema.V2d(16.0, 9.0) vec.append(otio.schema.Box2d(otio.schema.V2d(0.0, 0.0), otio.schema.V2d(16.0, 9.0)))
>>> d = otio._otio.AnyDictionary() >>> d["vec"] = otio.schema.V2d(16.0, 9.0) Traceback (most recent call last): File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 112, in _value_to_any return PyAny(value) ^^^^^^^^^^^^ TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. opentimelineio._otio.PyAny(arg0: bool) 2. opentimelineio._otio.PyAny(arg0: int) 3. opentimelineio._otio.PyAny(arg0: float) 4. opentimelineio._otio.PyAny(arg0: str) 5. opentimelineio._otio.PyAny(arg0: None) 6. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.SerializableObject) 7. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.RationalTime) 8. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeRange) 9. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeTransform) 10. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyVector) 11. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyDictionary) Invoked with: otio.schema.V2d(x=16.0, y=9.0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 175, in __setitem__ self.__internal_setitem__(key, _value_to_any(item)) ^^^^^^^^^^^^^^^^^^^ File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 115, in _value_to_any raise TypeError( TypeError: A value of type '<class 'opentimelineio._otio.V2d'>' is incompatible with OpenTimelineIO. OpenTimelineIO only supports the following value types in AnyDictionary containers (like the .metadata dictionary): ('int', 'float', 'str', 'bool', 'list', 'dictionary', 'opentime.RationalTime', 'opentime.TimeRange', 'opentime.TimeTransform', 'opentimelineio.core.SerializableObject'). >>> d["box"] = otio.schema.Box2d(otio.schema.V2d(0.0, 0.0), otio.schema.V2d(16.0, 9.0)) Traceback (most recent call last): File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 112, in _value_to_any return PyAny(value) ^^^^^^^^^^^^ TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. opentimelineio._otio.PyAny(arg0: bool) 2. opentimelineio._otio.PyAny(arg0: int) 3. opentimelineio._otio.PyAny(arg0: float) 4. opentimelineio._otio.PyAny(arg0: str) 5. opentimelineio._otio.PyAny(arg0: None) 6. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.SerializableObject) 7. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.RationalTime) 8. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeRange) 9. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeTransform) 10. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyVector) 11. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyDictionary) Invoked with: otio.schema.Box2d(min=otio.schema.V2d(x=0.0, y=0.0), max=otio.schema.V2d(x=16.0, y=9.0)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 175, in __setitem__ self.__internal_setitem__(key, _value_to_any(item)) ^^^^^^^^^^^^^^^^^^^ File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 115, in _value_to_any raise TypeError( TypeError: A value of type '<class 'opentimelineio._otio.Box2d'>' is incompatible with OpenTimelineIO. OpenTimelineIO only supports the following value types in AnyDictionary containers (like the .metadata dictionary): ('int', 'float', 'str', 'bool', 'list', 'dictionary', 'opentime.RationalTime', 'opentime.TimeRange', 'opentime.TimeTransform', 'opentimelineio.core.SerializableObject'). >>> vec = otio._otio.AnyVector() >>> vec.append(otio.schema.V2d(16.0, 9.0)) Traceback (most recent call last): File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 112, in _value_to_any return PyAny(value) ^^^^^^^^^^^^ TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. opentimelineio._otio.PyAny(arg0: bool) 2. opentimelineio._otio.PyAny(arg0: int) 3. opentimelineio._otio.PyAny(arg0: float) 4. opentimelineio._otio.PyAny(arg0: str) 5. opentimelineio._otio.PyAny(arg0: None) 6. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.SerializableObject) 7. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.RationalTime) 8. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeRange) 9. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeTransform) 10. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyVector) 11. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyDictionary) Invoked with: otio.schema.V2d(x=16.0, y=9.0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<frozen _collections_abc>", line 1078, in append File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 360, in insert index, conversion_func(item) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 115, in _value_to_any raise TypeError( TypeError: A value of type '<class 'opentimelineio._otio.V2d'>' is incompatible with OpenTimelineIO. OpenTimelineIO only supports the following value types in AnyDictionary containers (like the .metadata dictionary): ('int', 'float', 'str', 'bool', 'list', 'dictionary', 'opentime.RationalTime', 'opentime.TimeRange', 'opentime.TimeTransform', 'opentimelineio.core.SerializableObject'). >>> vec.append(otio.schema.Box2d(otio.schema.V2d(0.0, 0.0), otio.schema.V2d(16.0, 9.0))) Traceback (most recent call last): File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 112, in _value_to_any return PyAny(value) ^^^^^^^^^^^^ TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. opentimelineio._otio.PyAny(arg0: bool) 2. opentimelineio._otio.PyAny(arg0: int) 3. opentimelineio._otio.PyAny(arg0: float) 4. opentimelineio._otio.PyAny(arg0: str) 5. opentimelineio._otio.PyAny(arg0: None) 6. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.SerializableObject) 7. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.RationalTime) 8. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeRange) 9. opentimelineio._otio.PyAny(arg0: opentimelineio._opentime.TimeTransform) 10. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyVector) 11. opentimelineio._otio.PyAny(arg0: opentimelineio._otio.AnyDictionary) Invoked with: otio.schema.Box2d(min=otio.schema.V2d(x=0.0, y=0.0), max=otio.schema.V2d(x=16.0, y=9.0)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<frozen _collections_abc>", line 1078, in append File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 360, in insert index, conversion_func(item) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/ereinecke/Projects/stash/vertical-video-example/.venv/lib/python3.11/site-packages/opentimelineio/core/_core_utils.py", line 115, in _value_to_any raise TypeError( TypeError: A value of type '<class 'opentimelineio._otio.Box2d'>' is incompatible with OpenTimelineIO. OpenTimelineIO only supports the following value types in AnyDictionary containers (like the .metadata dictionary): ('int', 'float', 'str', 'bool', 'list', 'dictionary', 'opentime.RationalTime', 'opentime.TimeRange', 'opentime.TimeTransform', 'opentimelineio.core.SerializableObject').
[x] I believe this isn't a duplicate topic
[x] This report is not related to an adapter
Select One:
[ ] Build problem
[x] Incorrect Functionality or bug
[ ] New feature or functionality
Description
Setting
AnyDictionary
orAnyVector
values raises aTypeError
. All OTIO serializable types should be usable for things likemetadata
dictionaries.The fix should also test to make sure serialization and deserialization work properly.
Example:
Optional
Environment
OpenTimelineIO: 0.15.0 PyPI Operating System: macOS 13.6.6 Python version if appropriate: Python 3.11.6
Reproduction Steps
Log output if appropriate
Sample data and other attachements