Original User: palavidoHello GISers,Our organization has a single floating license of 3D Analyst and many times people inadvertently leave it enabled. I was hoping to make a simple Python Add-in that would check the 3D Analyst license in when ArcMap opens. I made a python add-in that executes the code below to check the license in. I set up logging so I could confirm the actions were being taken. The log reports that the license has been successfully checked in, however it still remains checked (enabled) in ArcMap (see screenshot).[ATTACH=CONFIG]25276[/ATTACH]
My question would be, is there some step in my code that I am missing or is the ChecInkExtension code only related to the scope of code execution and not the ArcMap extension GUI? I've also attached the source files for the python add-in in case anyone wants to compile and test themselves. You'll just need to change the path to the log file.
import arcpy
import pythonaddins
import logging
logger = logging.getLogger('myapp')
hdlr = logging.FileHandler(r'd:\Workspace\PythonAddIns\ExtensionChecker\agstest.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
class ExtensionChecker(object):
"""Implementation for ExtensionChecker_addin.extcheckerext (Extension)"""
def __init__(self):
# For performance considerations, please remove all unused methods in this class.
self.enabled = True
def startup(self):
logger.debug( "Fired startup")
stat = arcpy.CheckExtension("3D")
logger.debug(stat)
stat = arcpy.CheckInExtension("3D")
logger.debug(stat)
passThanks in advance for any help!
Matt