AnsweredAssumed Answered

ArcGIS crashes on simple addin

Question asked by jayarem on Sep 11, 2013
Latest reply on Sep 11, 2013 by JScheirer-esristaff

I'm starting to develop add-ins for a project. I have a very simple button that opens a new tab with Google Search results based on whatever footprint is selected at the time. Here's the code:

import arcpy import pythonaddins import webbrowser  mxd = arcpy.mapping.MapDocument('CURRENT')  layerList = arcpy.mapping.ListLayers(mxd) tableList = arcpy.mapping.ListTableViews(mxd) for layer in layerList:     if "Footprints_Edit" in         footprints_fc = layer     if "Parcels_Edit" in         parcels_fc = layer     if "Address" in         address_fc = layer for table in tableList:     if "Assessing" in         assessing_table = table     if "Condos" in         condo_table = table  class GoogleLookup(object):     """Implementation for building_footprints_Addin_addin.GoogleLookup (Button)"""     def __init__(self):         self.enabled = True         self.checked = False     def onClick(self, footprints_fc=footprints_fc):         fields = ["BCITY","BADDRESS"]         with arcpy.da.SearchCursor(footprints_fc,fields) as rows:             for row in rows:                 city = row[0]                 address = row[1]                 url = '''''' + address.replace(' ','+') + '''%22%2C+''' + city.replace(' ','+') + '''%2C+MI '''                 webbrowser.open_new_tab(url) 

Executing the code works, but then ArcGIS crashes immediately thereafter. I've gotten this to work before as a menu item but I lost that code! Any ideas?

Also, maybe .DMP should be a valid extension for forum uploads.