Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnyDictionary and AnyVector don't support Box2d and V2d #1714

Open
reinecke opened this issue Mar 29, 2024 · 0 comments · May be fixed by #1811
Open

AnyDictionary and AnyVector don't support Box2d and V2d #1714

reinecke opened this issue Mar 29, 2024 · 0 comments · May be fixed by #1811

Comments

@reinecke
Copy link
Collaborator

[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 or AnyVector values raises a TypeError. All OTIO serializable types should be usable for things like metadata dictionaries.

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').

Optional


Environment

OpenTimelineIO: 0.15.0 PyPI
Operating System: macOS 13.6.6
Python version if appropriate: Python 3.11.6

Reproduction Steps

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

Log output if appropriate

>>> 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').

Sample data and other attachements

@reinecke reinecke added the good first issue If you're looking for a way to contribute, but not sure where to start. This is a good first issue. label Mar 29, 2024
@reinecke reinecke changed the title AnyDictionary and AnyVector don't properly support Box2d and V2d AnyDictionary and AnyVector don't support Box2d and V2d Mar 29, 2024
@reinecke reinecke added this to the Public Beta 18 milestone Jun 20, 2024
@reinecke reinecke removed the good first issue If you're looking for a way to contribute, but not sure where to start. This is a good first issue. label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant