Error: "local variable 'resp' referenced before assignment"

11-09-2017 09:43 AM
Occasional Contributor

Just installed ArcGIS API for Python 1.2.4 using ArcGIS Pro. I can connect to my production portal that is using CA certificate without any issues, but cannot connect to my development portal that is using self-signed certificate. Both portals are secured by IWA. I have added verify_cert=False, but I am getting the error: "local variable 'resp' referenced before assignment" from the line below...

gis = GIS(portal_url, verify_cert=False)

How can I make this work?



Masao Matsuoka
Tags (1)
5 Replies
Esri Contributor

We're looking into this issue. Meanwhile, as a workaround till we have a fix, you may use the following code to bypass certificate verification completely in the Python process:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

from arcgis import GIS

gis = GIS('', verify_cert=False)

Please note that this is not for use in production environment, as it bypasses certificate verification in the entire Python process, not just to your portal which is using a self signed certificate. 

Occasional Contributor

Thanks for the help I have added the code, and now I am getting a different error...

10061, 'No connection could be made because the target machine actively refused it'

I can still connect to the production site with CA certificate, but not able to connect to the dev site with self-signed certificate.

Masao Matsuoka
New Contributor

Hi, Rohit, any update?

0 Kudos
New Contributor III

I was also getting this problem with arcgis python v1.5.1, installing winKerberos as per 209433 thread fixed it.

0 Kudos
MVP Regular Contributor

This is the thread Leon mentions: 

0 Kudos