Hi,
we would like to upload movies or images through the API directly to Shotgun. We have no problem doing any operations but there is an issue with the upload, giving this error :
Traceback (most recent call last):
File “\tools\shotgun\sgprod.py”, line 104, in
session.upload(“Version”, version[‘id’], img_file, “sg_uploaded_movie”)
File “\tools\python\site-packages\shotgun_api3\shotgun.py”, line 2343, in upload
tag_list, is_thumbnail)
File “\tools\python\site-packages\shotgun_api3\shotgun.py”, line 2379, in _upload_to_storage
self._upload_file_to_storage(path, upload_info[“upload_url”])
File “\hydro\tools\python\site-packages\shotgun_api3\shotgun.py”, line 3794, in _upload_file_to_storage
self._upload_data_to_storage(fd, content_type, file_size, storage_url)
File “\hydro\tools\python\site-packages\shotgun_api3\shotgun.py”, line 3886, in _upload_data_to_storage
result = opener.open(request)
File “C:\Python27\lib\urllib2.py”, line 429, in open
response = self._open(req, data)
File “C:\Python27\lib\urllib2.py”, line 447, in _open
‘_open’, req)
File “C:\Python27\lib\urllib2.py”, line 407, in _call_chain
result = func(*args)
File “C:\Python27\lib\urllib2.py”, line 1241, in https_open
context=self._context)
File “C:\Python27\lib\urllib2.py”, line 1198, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>
We did read through some older messages we could find online, some solutions from Shotgun website are not accessible anymore, we tried the other suggestion we could find or think of such as :
- using Python 2.7.16
- updated to latest shotgun_api3 package
- added the three following lines in our code (which gave an other error written below)
import ssl
import functools
partialcreateHttps = functools.partial(ssl._create_default_https_context, cafile=‘C:\tmp\cert.pem’, capath=‘C:\tmp\certs’)
ssl._create_default_https_context = partialcreateHttps
Traceback (most recent call last):
File “\tools\shotgun\sgprod.py”, line 104, in
session.upload(“Version”, version[‘id’], img_file, “sg_uploaded_movie”)
File “\tools\python\site-packages\shotgun_api3\shotgun.py”, line 2343, in upload
tag_list, is_thumbnail)
File “\tools\python\site-packages\shotgun_api3\shotgun.py”, line 2371, in _upload_to_storage
upload_info = self._get_attachment_upload_info(is_thumbnail, filename, is_multipart_upload)
File “\tools\python\site-packages\shotgun_api3\shotgun.py”, line 2521, in _get_attachment_upload_info
upload_info = self._send_form(url, params)
File “\tools\python\site-packages\shotgun_api3\shotgun.py”, line 3979, in _send_form
resp = opener.open(url, params)
File “C:\Python27\lib\urllib2.py”, line 429, in open
response = self._open(req, data)
File “C:\Python27\lib\urllib2.py”, line 447, in _open
‘_open’, req)
File “C:\Python27\lib\urllib2.py”, line 407, in _call_chain
result = func(*args)
File “C:\Python27\lib\urllib2.py”, line 1241, in https_open
context=self._context)
File “C:\Python27\lib\urllib2.py”, line 1167, in do_open
h = http_class(host, timeout=req.timeout, **http_conn_args)
File “C:\Python27\lib\httplib.py”, line 1247, in init
context = ssl._create_default_https_context()
File “C:\Python27\lib\ssl.py”, line 440, in create_default_context
context.load_verify_locations(cafile, capath, cadata)
IOError: [Errno 2] No such file or directory
Any suggestion?
Thanks
Chris