I am trying to create local linked files on Shotgun using python api. The example on the forum is given for a "sg_uploaded_movie" and sg.update/create on entity Version. I am trying to sg.create/update on the entitiy "attachment" and then link an asset item to it. But so far I am failing to create the attachment. Perhaps my "data" definition is wrong. Can you help me?
Following is my code snippet:
data = {'filename': {'local_path': '/Volumes/DCP-Playmation/Pipeline/mnt/projects/test_project/DLG_CLUESRCH_JRVS_01.wav','name': 'foo'},
'project': {'type':'Project','id':projectId}
# 'attachment_links':{'type':'Asset','id':1756}
}
result = sg.create('Attachment', data)
pprint(result)
and here is the error I get:
Traceback (most recent call last):
File "test_project_script_1.py", line 105, in <module>
result = sg.create('Attachment', data)
File "/Volumes/DCP-Playmation/Pipeline/mnt/software/python-api/shotgun_api3/shotgun.py", line 614, in create
record = self._call_rpc("create", params, first=True)
File "/Volumes/DCP-Playmation/Pipeline/mnt/software/python-api/shotgun_api3/shotgun.py", line 1477, in _call_rpc
self._response_errors(response)
File "/Volumes/DCP-Playmation/Pipeline/mnt/software/python-api/shotgun_api3/shotgun.py", line 1684, in _response_errors
"Unknown Error"))
shotgun_api3.shotgun.Fault: API create() Attachment.filename is read only:
{"field_name"=>"filename",
"value"=>
{"local_path"=>
"/Volumes/DCP-Playmation/Pipeline/mnt/projects/test_project/DLG_CLUESRCH_JRVS_01.wav",
"name"=>"foo"}}
Is there a good way to know how to setup the data so that create/update will be successful.