Thursday, 14 July 2016

arcpy - ArcGIS python add in to call Python script for importing mdb data


I'm trying to change from a.net toolbar to a Python toolbar in ArcGIS 10.2 and am having some difficulty. I have some stand alone python script which I know works and does what I need to do but I can't work out how to get the add in button to call this script or how to incorporate the script in with the button add in script.


import arcpy
import pythonaddins

class ImportCSVFile(object):
"""Implementation for Import_CSV.button (Button)"""

def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
script1 = "C:\Users\xxx\Documents\AddIns\pythonAddin\Install\xxx"
execfile(script1)

I've also tried using os.startfile(xxxxx) instead of script1 = "xxxx" and execfile(script1).


I don't get an error but the button doesn't do anything. Does anyone have any ideas of how to get this to work?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...