Hi,
I’ve been trying the multi-publish2 tool and found that when I enter a new Asset in the Link field it fails.
Traceback (most recent call last):
File “/rakete/home/ldap/nrehberg/workspace/gits/mau/sgtk/install/app_store/tk-framework-qtwidgets/v2.8.6/python/context_selector/context_widget.py”, line 633, in _on_entity_activated
self._on_context_activated(context)
File “/rakete/home/ldap/nrehberg/workspace/gits/mau/sgtk/install/app_store/tk-framework-qtwidgets/v2.8.6/python/context_selector/context_widget.py”, line 623, in _on_context_activated
self._show_context(context)
File “/rakete/home/ldap/nrehberg/workspace/gits/mau/sgtk/install/app_store/tk-framework-qtwidgets/v2.8.6/python/context_selector/context_widget.py”, line 841, in _show_context
link_display = _get_link_display(context)
File “/rakete/home/ldap/nrehberg/workspace/gits/mau/sgtk/install/app_store/tk-framework-qtwidgets/v2.8.6/python/context_selector/context_widget.py”, line 903, in _get_link_display
entity_name = entity[“name”]
KeyError: ‘name’
I followed the code and found that the problem lies in context_from_entity, which returns an None Asset:
DEBUG [16:27:45 425.107955933]: Context changed to: Asset None
After some more digging in context.py the call in line 1242
entity_context = _context_data_from_cache(tk, entity_type, entity_id)
gives back this
{'project': {'type': 'Project', 'id': 89, 'name': 'Maurice'}, 'additional_entities': [], 'step': None, 'task': None, 'tk': <Sgtk Core v0.18.172@0x7f486b6d0150 Config /rakete/home/ldap/nrehberg/workspace/gits/mau/sgtk>, 'user': None, 'source_entity': None, 'entity': {'type': u'Asset', 'id': 1729}}
Since the project dict is filled in, the following check on line 1245 does not trigger a real shotgun lookup and thus I get a broken context back. Is this a bug?
This seems to only happen with Assets, when I use the Task field and thus context_from_entity queries a task it works fine.
For now I’ll add an extra check for the entity name in line 1245 , which seems to help.
Cheers,
Nico