0

task_assignees Filter not working :-(

So when I search for shots assigned to a particular artist I type in:

 

sg.find("Shot", filters=[['project', 'is', projectID], ["task_assignees", "name_is", "Bob"]], fields=['id', 'code']) 

 

However when I do this I get the following error:

 

Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
shotProjList = sg.find("Shot", filters=[['project', 'is', projectID], ["task_assignees", "name_is", "Bob"]], fields=['id', 'code'])
File "C:\Python27\lib\shotgun_api3\shotgun.py", line 453, in find
result = self._call_rpc("read", params)
File "C:\Python27\lib\shotgun_api3\shotgun.py", line 1270, in _call_rpc
self._response_errors(response)
File "C:\Python27\lib\shotgun_api3\shotgun.py", line 1466, in _response_errors
"Unknown Error"))
Fault: API read() Shot.task_assignees doesn't exist:
{"relation"=>"name_is", "values"=>["Bob"], "path"=>"task_assignees"}

 

Why? What am I doing wrong? 

2件のコメント

  • 0
    Avatar
    Manley Gage

    Anyone? 

  • 1
    Avatar
    Patrick Boucher

    Hi Manley,

    The last two lines you see in the error:

    Fault: API read() Shot.task_assignees doesn't exist:
    {"relation"=>"name_is", "values"=>["Bob"], "path"=>"task_assignees"}

    ...mean that the Shot entity does not have a field who's code is "task_assignees".

    The "task_assignees" field is generally on the Task entity so that a Task is assigned to a user, and a Task is also linked to a Shot. This means that to know which artists are working on which Shots you should actually be looking at tasks assigned to a particular artist and determining which Shot that Task is connected to.

    Here is an example:

    user = sg.find('HumanUser', [['name', 'is', 'Bob']])
    project = {'type': 'Project', 'id': projectID}
    info = sg.find('Task', [['project', 'is', project], ['task_assignees', 'is', user]], fields=['entity.Shot.code', 'entity.Shot.id'])

    This will populate the info variable with a list of dictionaries, one dictionary per Task assigned to Bob. Each dictionary will in turn contain the Shot code and id to which this Task is linked. Be warned that this means that you may find multiple returns that point to the same Shot if Bob is assigned to multiple Tasks on the same Shot.

    I hope this helps!

     

    Cheers,

    Pat

ログインしてコメントを残してください。