I am trying to create an attachment from a jpeg file.
What is wrong with my data syntax?
logger.info(' ===== attachment_path: %s' % attachment_path)
logger.info(' ===== attachment_name: %s' % attachment_name)
attachment_data = { 'project': self._app.context.project,
'this_file': {'content_type': 'image/jpeg',
'link_type': 'upload',
'name':attachment_name,
'url':attachment_path
}
}
sg_attachment = self._app.shotgun.create('Attachment',attachment_data,['id'])
===== attachment_path: /var/folders/vt/6bwbz02s6nsf2s1gj1gvmvf9g8sgjg/T/5fc5bb430a6c48bfa3485f01896cb279_sgtk.jpg
===== attachment_name: 5fc5bb430a6c48bfa3485f01896cb279_sgtk.jpg
Traceback (most recent call last):
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/dialog.py”, line 153, in _on_add_note_btn_clicked
note)
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/dialog.py”, line 274, in add_note_to_version
note_attachment = self.create_attachment(attachment_path)
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/dialog.py”, line 310, in create_attachment
sg_attachment = self._app.shotgun.create(‘Attachment’,attachment_data,[‘id’])
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/core/python/tank_vendor/shotgun_api3/shotgun.py”, line 1240, in create
record = self._call_rpc(“create”, params, first=True)
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/core/python/tank/authentication/shotgun_wrapper.py”, line 63, in _call_rpc
return super(ShotgunWrapper, self)._call_rpc(*args, **kwargs)
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/core/python/tank_vendor/shotgun_api3/shotgun.py”, line 3169, in _call_rpc
self._response_errors(response)
File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/core/python/tank_vendor/shotgun_api3/shotgun.py”, line 3465, in _response_errors
raise Fault(sg_response.get(“message”, “Unknown Error”))
tank_vendor.shotgun_api3.shotgun.Fault: API create() invalid/missing url hash string ‘url’:
{“url”=>
“/var/folders/vt/6bwbz02s6nsf2s1gj1gvmvf9g8sgjg/T/5fc5bb430a6c48bfa3485f01896cb279_sgtk.jpg”,
“content_type”=>“image/jpeg”,
“link_type”=>“upload”,
“name”=>“5fc5bb430a6c48bfa3485f01896cb279_sgtk.jpg”}