SSL certificate error on sgtk.util.regiter_publish

Hi, im developing some tools for digital assets in Houdini 17.5 …

while using a build toolkit app, I execute a hook which try to register the published file.

At the moment the script executes the code:

    args = {
        "tk": self.parent.tank,
        "context": self.parent.engine.context,
        "path": esto['operator'],
        "name": os.path.basename(esto['operator']),
        "version_number": 6,
        "published_file_type": "Library item",
    }
    print 'sgtk: ', sgtk.__file__
    sg_publish = sgtk.util.register_publish(**args)

The published files is registered correctly in shotgun , but it also drop the following error.

---------------------------------------------------------------------------
[ERROR publish_creation] <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>
Traceback (most recent call last):
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank/util/shotgun/publish_creation.py", line 308, in register_publish
    tk.shotgun.upload_thumbnail(published_file_entity_type, entity.get("id"), no_thumb)
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank_vendor/shotgun_api3/shotgun.py", line 2173, in upload_thumbnail
    field_name="thumb_image", **kwargs)
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank_vendor/shotgun_api3/shotgun.py", line 2263, in upload
    tag_list, is_thumbnail)
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank_vendor/shotgun_api3/shotgun.py", line 2383, in _upload_to_sg
    result = self._send_form(url, params)
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank_vendor/shotgun_api3/shotgun.py", line 3806, in _send_form
    resp = opener.open(url, params)
  File "/opt/hfs17.5.173/python/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/opt/hfs17.5.173/python/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/opt/hfs17.5.173/python/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/opt/hfs17.5.173/python/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/opt/hfs17.5.173/python/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>
Traceback (most recent call last):
  File "/home/cvizcarra/ollinDev/PIGS_kDev/config/hooks/publish_digital_asset.py", line 66, in register_publishedfile
    description='Alembic nodes.')
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank/log.py", line 503, in wrapper
    response = func(*args, **kwargs)
  File "/home/cvizcarra/ollinDev/PIGS_kDev/install/core/python/tank/util/shotgun/publish_creation.py", line 323, in register_publish
    entity=entity
ShotgunPublishError: Unable to complete publishing because of the following error: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>, although PublishedFile PIGS_libary_tool_hda_asasas_v017.hda (id: 114715
) was created.
---------------------------------------------------------------------------

I cant find why this error is coming out, If we use hooks and register_publish within nuke engine, everything works fine!!!

1 Like

Hi Christian

This is a bit tricky. I suspect that it is failing because it can’t upload a thumbnail. The register method always uploads a thumbnail. Even if you don’t provide it with one, it will upload a placeholder thumbnail.

So the question becomes why can’t it upload media.
To start with, I would check what version of core you are running, and try the latest if you’re not on it. Though I suspect that is not the issue as it’s working fine in Nuke. Really what you are looking to ensure here is that by updating core, you are also ensuring it’s bundled with and using the latest SG API.

Failing that, I would suggest checking out this doc and seeing if any of the suggestions there help. I suspect this is more likely to be the issue, as it’s probably tied to the version of Python being run in the software you’re using, and the certificates it ships with.

2 Likes

Weel I have upgrade true ./tank core upgrade

The version shown in Shotgun desktop About window with selected proyect is:

App Version v1.5.0
Startup version v1.10.5
Engine Version v2.4.12
Core v0.18.168 <-------- latest core updated!
toolkit Basic Configuration v1.2.9

Then via Shotgun Desktop, Houdini engine is launched …
open an asset or shot,
then if I open "Work are info… " window, it promp an error with the same SSL problem…


[INFO tk-multi-about] Could not get thumbnail for url ‘https://sg-media-usor-01.s3-accelerate.amazonaws.com/8a73d064935
0cde165b82f9d4c481e080547f56d/cfe7ba5ffb9896cd568ccd544f1ee25b26f534d6/RackMultipart20190208-12744-qe2uwr_t.jpg?respons
e-content-disposition=filename%3D%22RackMultipart20190208-12744-qe2uwr_t.jpg%22&x-amz-meta-user-id=380&x-amz-meta-user-
type=HumanUser&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYJG6Z4JI3E6XNWMI%2F20191009%2Fus-west-2%2Fs3%2Faws
4_request&X-Amz-Date=20191009T165656Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=d65981cab95110b2e03873
e010076ccd529a1681043ac613c8d75fa97175cb4b’. Error: Could not download contents of url ‘https://sg-media-usor-01.s3-acc
elerate.amazonaws.com/8a73d0649350cde165b82f9d4c481e080547f56d/cfe7ba5ffb9896cd568ccd544f1ee25b26f534d6/RackMultipart20
190208-12744-qe2uwr_t.jpg?response-content-disposition=filename%3D%22RackMultipart20190208-12744-qe2uwr_t.jpg%22&x-amz-
meta-user-id=380&x-amz-meta-user-type=HumanUser&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYJG6Z4JI3E6XNWMI%
2F20191009%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20191009T165656Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz
-Signature=d65981cab95110b2e03873e010076ccd529a1681043ac613c8d75fa97175cb4b’. Error reported: <urlopen error [SSL: CERT
IFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>

if I try to publish, it turns again the SSL: CERTIFICATE_VERIFY_FAILED

This behave is just on Houdini engine but nor in Nuke and Maya.

It seems I was missing the cacert.pem and the required environment variable
SHOTGUN_API_CACERTS pointing to that location.

Now the error is not appearing any more.

Thanks : )

2 Likes