AnsweredAssumed Answered

Reviving an Arcpy Addins Extension

Question asked by jborgion Champion on Sep 28, 2018
Latest reply on Oct 1, 2018 by jborgion

A year or so ago I was working with Arcpy Addins. I had created an extension that  used to run a def openDocument() that creates a numpy array out of a table view:

class ExtensionClass1(object):
    """Implementation for AddressValidatorExtension_addin.extension2 (Extension)"""
    def __init__(self):
        # For performance considerations, please remove all unused methods in this class.
        self.enabled = True
    def openDocument(self):      
                    myTable = r"I:\GIS\ArcSDE\SuperUser\slcogis\gdb_ADD\gdb_ADD@slcogis.sde\SLCOGIS.gdb_ADD.JoesArray_vw"
          fields = ['FULLNAME', 'LowCoordName', 'HighCoordName','Alias1','Alias2','Alias3','Alias4','STR2_LOW_RANGE','STR2_HIGH_RANGE']
          global arr
          arr = arcpy.da.TableToNumPyArray(myTable,fields)

 The problem is when I try to execute the other functionalities of the extension it errors out at the first call to that array: 


Traceback (most recent call last):
  File "C:\Users\JBorgione\AppData\Local\ESRI\Desktop10.5\AssemblyCache\{FB53601C-244C-4DF3-87C2-E18F723FA707}\", line 71, in onEnter
    name = arr[np.where(arr['FULLNAME'] == enteredName)]
NameError: global name 'arr' is not defined


Not sure what I'm missing, and hoping another set of eyes can catch it