Error running or self.parent.shotgun.find() from context_change() hook

Hi All,

Just wondering if anyone has come across an error similar to the one I’m getting when I call from the context_change() hook?

[Errno 2] No such file or directory
Traceback (most recent call last):
  File "/Volumes/sandbox/tomfw/git/config2/core/hooks/", line 153, in post_context_change
  File "/Volumes/sandbox/tomfw/git/config2/core/hooks/", line 204, in update_environment
    project_entity = self.get_sg_entity(context.project)
  File "/Volumes/sandbox/tomfw/git/config2/core/hooks/", line 279, in get_sg_entity
    self.logger.debug(" {}".format(
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/", line 799, in info
    return self._call_rpc("info", None, include_auth_params=False)
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank/authentication/", line 63, in _call_rpc
    return super(ShotgunWrapper, self)._call_rpc(*args, **kwargs)
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/", line 3334, in _call_rpc
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/", line 3488, in _make_call
    return self._http_request(verb, path, body, req_headers)
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/", line 3542, in _http_request
    resp, content = conn.request(url, method=verb, body=body, headers=headers)
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/lib/httplib2/python2/", line 1925, in request
    conn, authority, uri, request_uri, method, body, headers, redirections, cachekey,
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/lib/httplib2/python2/", line 1634, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/lib/httplib2/python2/", line 1553, in _conn_request
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/lib/httplib2/python2/", line 1239, in connect
  File "/home/users/tomfw/.shotgun/union/p2160c4370.basic.desktop/cfg/install/core/python/tank_vendor/shotgun_api3/lib/httplib2/python2/", line 98, in _ssl_wrap_socket
IOError: [Errno 2] No such file or directory

To be fully clear I don’t really want the… I’m actually trying to run a shotgun.find() but that is also failing with a similar error… but I’d tied as I thought it might be more “basic” for troubleshooting purposes.

I’ll keep debugging at my end… but if anyone’s encountered this before I’d love to hear from you :slight_smile:


Are you running this from a renderfarm?
Or what kind of environment?

You are running into an issue where your CA certicates are not refreshed.

If you set the following environment variable:


and point it to this file somewhere on disk:

Then it will work.
If running in an engine or from SG Desktop this should not be needed.
But farm processes do need this.

1 Like

Hey @Ricardo_Musch ,

Thanks for your swift reply!

Turns out your were bang on the money! We have have a custom module for managing our environment variables that runs during the and that was overwriting the SHOTGUN_API_CACERTS env var to a non-existent file path. Now that I’ve updated our system for that so it picks it up in a more dynamic way (and finds a file that I’m distributing with the sgtk config itself) it’s working fine.

Thanks very much for your help!


1 Like