AnsweredAssumed Answered

UnboundLocalError: local variable 'resp' referenced before assignment error using Juypter Notebook

Question asked by Bennett.Morris on May 29, 2019
Latest reply on Aug 28, 2019 by Bennett.Morris



I recently got a new work computer and I have a Juypter notebook that I have been using for some time and it's no longer working.  My python code logs into our Portal so I can run other reports.  I can log onto AGOL using this script, but not our Portal any more.  Here is the code:


from arcgis.gis import GIS
from IPython.display import display
from getpass import getpass
import sys
import datetime
import time

ArcGISwebsite = input("Enter ArcGIS Portal / AGOL URL: ")
username = input("Enter user name: ")
password = getpass("Enter password: ")
g = GIS(ArcGISwebsite, username, password)

if == True:
   print("\nConnected to: {}\n\nConnected as: {}".format( + " (" + +")",
   print("\nConnected to: {}\n\nConnected as: {}".format( + " (" + + "." + +")",


I receive the "UnboundLocalError: local variable 'resp' referenced before assignment" at "g = GIS(ArcGISwebsite, username, password)".  I'm running Windows 10 Pro, ArcGIS Pro 2.3.3, ArcMap 10.7. Any help would be greatly appreciated.  Thanks!