Skip to content

KeyError: 00000000-0000-0000-0000-000000000000 when using dump #149

@mrlimbic

Description

@mrlimbic

When dumping an AAF exported from Nuendo I get a key error.

AAF spec considers an ID of 00000000-0000-0000-0000-000000000000 to mean null/empty value however this seems to crash the dump code in pyaaf2. I think pyaaf2 needs to support these null/empty values by just ignoring them or maybe assigning None.

Where it crashed in the dump and stack trace:

     CodecDefinitions <kAAFTypeID_CodecDefinitionStrongReferenceSet TypeDefSet>
       <aaf2.dictionary.CodecDef AIFC Codec 4b1c1a45-03f2-11d4-80fb-006008143e6f at 0x102c696d0>
         FileDescriptorClass <ClassDefinitionWeakReference TypeDefWeakRef> <AIFCDescriptor ClassDef>
         DataDefinitions <kAAFTypeID_DataDefinitionWeakReferenceVector TypeDefVarArray> [<aaf2.dictionary.DataDef DataDef_Sound 01030202-0200-0000-060e-2b3404010101 at 0x102c699f0>, <aaf2.dictionary.DataDef DataDef_LegacySound 78e1ebe1-6cef-11d2-807d-006008143e6f at 0x102c69a40>, <aaf2.dictionary.DataDef DataDef_Sound 01030202-0200-0000-060e-2b3404010101 at 0x102c699f0>]
         Identification <AUID TypeDefRecord> 4b1c1a45-03f2-11d4-80fb-006008143e6f
         Description <aafString TypeDefString> Handles RIFF AIFC data.
         Name <aafString TypeDefString> AIFC Codec
       <aaf2.dictionary.CodecDef Unknown Codec 568fb761-9458-11d2-8089-006008143e6f at 0x102c69bd0>
Traceback (most recent call last):
  File "/Users/john/Development/python/pyaaf2/examples/aafdump.py", line 11, in <module>
    f.dump()
    ~~~~~~^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/file.py", line 359, in dump
    self.root.dump()
    ~~~~~~~~~~~~~~^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/core.py", line 372, in dump
    p.value.dump(space + indent)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/core.py", line 372, in dump
    p.value.dump(space + indent)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/core.py", line 385, in dump
    obj.dump(space + indent*2)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/core.py", line 388, in dump
    safe_print(space, p.name, p.typedef, p.value)
                                         ^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/properties.py", line 1067, in value
    return resolve_weakref(self, self.ref)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/properties.py", line 997, in resolve_weakref
    return p.parent.root.resovle_weakref(p.weakref_index, p.key_pid, ref)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/file.py", line 283, in resovle_weakref
    return p[ref]
           ~^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aaf2/properties.py", line 849, in __getitem__
    raise KeyError(key)
KeyError: 00000000-0000-0000-0000-000000000000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions