SG throws urllib.error.URLError while connecting through shotgun API

When we are connecting shotgun through API the following error we are getting and it is not consistent always. Randomly we are getting this error, but nowadays the percentage of getting error got increased in our production.

Traceback (most recent call last):

File “\internal\maya_animation\0.0.99\python\maya_animation\publish\anm_publish_ui.py”, line 211, in publish

shot_name, instance_name, start_frame, end_frame, rig_controls

File “\internal\maya_animation\0.0.99\python\maya_animation\publish\anm_publish.py”, line 155, in export_atom_curves

self.thumbmail)

File “\internal\publish_pipeline\0.0.14\python\publish_pipeline\api.py”, line 105, in publish

g_asset.driver.upload_thumbnail_for_publish(published_file[‘id’], thumbmail)

File “\internal\backend_asset_driver\0.0.30/python/backend_asset_driver/drivers\sgctx.py”, line 467, in upload_thumbnail_for_publish

“PublishedFile”, published_file_id, thumbnail_filepath

File “\external\shotgun_api\3.2.6\python\shotgun_api3\shotgun.py”, line 2295, in upload_thumbnail

return self.upload(entity_type, entity_id, path, field_name=“thumb_image”, **kwargs)

File “\external\shotgun_api\3.2.6\python\shotgun_api3\shotgun.py”, line 2401, in upload

tag_list, is_thumbnail)

File “\external\shotgun_api\3.2.6\python\shotgun_api3\shotgun.py”, line 2429, in _upload_to_storage

upload_info = self._get_attachment_upload_info(is_thumbnail, filename, is_multipart_upload)

File “\external\shotgun_api\3.2.6\python\shotgun_api3\shotgun.py”, line 2579, in _get_attachment_upload_info

upload_info = self._send_form(url, params)

File “\shotgun_api\3.2.6\python\shotgun_api3\shotgun.py”, line 4101, in _send_form

resp = opener.open(url, params)

File “C:\Program Files\Autodesk\Maya2022\Python37\lib\urllib\request.py”, line 525, in open

response = self._open(req, data)

File “C:\Program Files\Autodesk\Maya2022\Python37\lib\urllib\request.py”, line 543, in _open

‘_open’, req)

File “C:\Program Files\Autodesk\Maya2022\Python37\lib\urllib\request.py”, line 503, in _call_chain

result = func(*args)

File “\external\shotgun_api\3.2.6\python\shotgun_api3\shotgun.py”, line 4153, in https_open

return self.do_open(self.create_https_connection, req)

File “C:\Program Files\Autodesk\Maya2022\Python37\lib\urllib\request.py”, line 1321, in do_open

raise URLError(err)

urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

Check if you are using the latest version of the ap library.
Also worth checking in with your IT department if the firewall could be blocking traffic.

Hi Ricardo,

Thanks for your valuable information.

How to monitor the query traffic and responses in SG? If SG request got failed where we can view the failure log details with the reason.

Regards
Narasimham k

You should be logging from your application, you can also use a logging tool like Sentry for example.

Hello everyone, sorry for the delay. We’ve been working on this workaround to enable seamless retries when AWS server error like these happens.

I have this PR in testing: SG-35165 Retry on URLError by carlos-villavicencio-adsk · Pull Request #342 · shotgunsoftware/python-api · GitHub it would be great if anyone else can give it a try. I know it’s hard to reproduce.

Cheers

2 Likes