AnsweredAssumed Answered

Error w/ Add-In

Question asked by rangermry on Aug 29, 2013
Latest reply on Aug 30, 2013 by rangermry
I am writing an Add-In of a Toolbox with Buttons that open certain folders or files.  These file aid in data entry.  I can get my buttons to show up but they are not working.  Is it I cannot use the os library in my burron classes?  Do I haveto import it some special way or add it to the XML file someway?  I used the Add-In Wizard.  I get this error in the Python Window in my MXD:

>>>  Traceback (most recent call last):   File "C:\Documents and Settings\me\Local Settings\Application Data\ESRI\Desktop10.1\AssemblyCache\{blahblah}\", line 10, in onClick     class button1959(object): NameError: global name 'os' is not defined

This is my code for the addin:
import arcpy import pythonaddins from os import *  def openLink(link):     """Opens a link up in Windows' default program for extension"""     startfile(link)     return 0  class button1959(object):     """Implementation for b1959.button (Button)"""     def __init__(self):         self.enabled = True         self.checked = False     def onClick(self):         openLink(r"\\fullfilepathhere\\")  class button1972(object):     """Implementation for b1972.button (Button)"""     def __init__(self):         self.enabled = True         self.checked = False     def onClick(self):         openLink(r"\\fullfilepathhere\\")