0

I'm trying to use tool bar buttons (python addins) to add a filepath and then append another feature class (known to have identical schema, no test needed) to that filepath. My syntax isn't working for some reason.

import arcpy, os
from arcpy import env
import pythonaddins
import re
sdeconn1 = r"J:\STW\Divisions_&_Branches\MSMD\Branches_&_Sections\GIS\users\Anault\intersections_software_development\Connection to ffxsde.sde"
class WORKSPACEPATH(object):
 """Implementation for addin_addin.WORKSPACEPATH (Button)"""
 def __init__(self):
 self.enabled = True
 self.checked = False
 def onClick(self):
 layer_files = pythonaddins.OpenDialog('Select Layers', True, r'C:\GISData', 'Add')
 mxd = arcpy.mapping.MapDocument('current')
 df = pythonaddins.GetSelectedTOCLayerOrDataFrame()
 list22 = []
 if not isinstance(df, arcpy.mapping.Layer):
 for layer_file in layer_files:
 layer = arcpy.mapping.Layer(layer_file)
 list22.append(layer_file)
 pythonaddins.MessageBox(str(list22), 'INFO', 0)
 else:
 pythonaddins.MessageBox('Select a data frame', 'INFO', 0)
class APPEND(object):
 """Implementation for addin_addin.APPEND (Button)"""
 def __init__(self):
 self.enabled = True
 self.checked = False
 def onClick(self):
 arcpy.Append_management(r"J:\STW\Divisions_&_Branches\MSMD\Branches_&_Sections\GIS\users\Anault\intersections_software_development\OUTPUT.gdb\STW_ST_SIGNS", list22, "NO_TEST","","")
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Mar 10, 2016 at 22:34
1
  • 2
    Have you tried opening the Python window of ArcMap to look for any error message thrown when you click the button? Commented Mar 10, 2016 at 22:41

1 Answer 1

1

To try and debug this I think you should open the Python window of ArcMap, and look for any error messages thrown when you click the button.

This is described in the Debugging Python add-ins page of the help:

When an add-in fails to work, it is commonly due to a coding or syntax error in the Python script. To discover what exception is being raised, open the Python window in ArcGIS. The exception is automatically printed to the Python window, providing the exact location and cause of the error

and it is the first, and usually only, step I need to debug my Python AddIn buttons.

answered Mar 11, 2016 at 1:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.