Hi All,
I am trying to get the name of asset using entity ID. I have daemon running which grabs the change in a entity field. The output is as below :
{‘attribute_name’: ‘sg_status_list’,
‘created_at’: datetime.datetime(2023, 10, 31, 15, 30, 12, tzinfo=<shotgun_api3.lib.sgtimezone.LocalTimezone object at 0x00000220041D28C0>),
‘entity’: {‘id’: 3468, ‘name’: ‘Art’, ‘type’: ‘Task’},
‘event_type’: ‘Shotgun_Task_Change’,
‘id’: 481322,
‘meta’: {‘attribute_name’: ‘sg_status_list’,
‘entity_id’: 3468,
‘entity_type’: ‘Task’,
‘field_data_type’: ‘status_list’,
‘new_value’: ‘ip’,
‘old_value’: ‘fin’,
‘type’: ‘attribute_change’},
‘project’: {‘id’: 70, ‘name’: ‘Demo: Animation’, ‘type’: ‘Project’},
‘session_uuid’: ‘88b497d0-77ca-11ee-83cd-0242ac110004’,
‘type’: ‘EventLogEntry’,
‘user’: {‘id’: 88, ‘name’: ‘huhu’, ‘type’: ‘HumanUser’}}
Now that I have above output as “event” dict I want to grab asset name and change the status of “model” or “rig” or “texture” dept to “wip”.
i have done following code :
asset_name = sg.find(‘Asset’, [[‘project’, ‘is’, {‘type’: ‘Project’, ‘id’: 70}], [‘entity’, ‘is’, {‘type’: ‘Step’, ‘id’: 3468, ‘name’: ‘Art’}]])
print(asset_name)
Giving following error :
Traceback (most recent call last):
File “d:\shotgrid\shotgrid_event_creator\shotgrid_event_creator.py”, line 617, in
asset_name = sg.find(‘Asset’, [[‘project’, ‘is’, {‘type’: ‘Project’, ‘id’: 70}], [‘entity’, ‘is’, {‘type’: ‘Task’, ‘id’: 3468, ‘name’: ‘Art’}]])
File “C:\Users\zabronic\AppData\Local\Programs\Python\Python310\lib\site-packages\shotgun_api3\shotgun.py”, line 1057, in find
result = self._call_rpc(“read”, params)
File “C:\Users\zabronic\AppData\Local\Programs\Python\Python310\lib\site-packages\shotgun_api3\shotgun.py”, line 3423, in _call_rpc
self._response_errors(response)
File “C:\Users\zabronic\AppData\Local\Programs\Python\Python310\lib\site-packages\shotgun_api3\shotgun.py”, line 3740, in _response_errors
raise Fault(sg_response.get(“message”, “Unknown Error”))
shotgun_api3.shotgun.Fault: API read() Asset.entity doesn’t exist:
{“path”=>“entity”,
“relation”=>“is”,
“values”=>[{“type”=>“Step”, “id”=>3468, “name”=>“Art”}]}