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

5056
5
11-09-2017 09:43 AM
MasaoMatsuoka
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?

Thanks

Masao

Masao Matsuoka
Tags (1)
5 Replies
RohitSingh2
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('https://yoururl.com/portal', 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. 

MasaoMatsuoka
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
jiaweixiao
New Contributor

Hi, Rohit, any update?

0 Kudos
LeonAus
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
AndresCastillo
MVP Regular Contributor

This is the thread Leon mentions:

https://community.esri.com/thread/209433 

0 Kudos