ArcMap Desktop 10.2, Windows 7, Python 2.7.3
Attempting to set up a very basic add in extension for testing. I have used the Add In Wizard to establish the project folders/ files, run makeaddin.py and then run the .esriaddin to install the add in.
This is intended to open a message box and print a message to the python immediate window upon opening the mxd but I get nothing. It doesn't error out. It just never kicks off. I can see the Add In under Customize in the mxd.
Except for selecting the openDocument method I left all other inputs at the defaults. I've also tried this with the startup method and got the same non-result.
Here is my script (indents not enforced):
import arcpy
import pythonaddins
class ExtensionClass1(object):
"""Implementation for TEST_addin.extension2 (Extension)"""
def __init__(self):
# For performance considerations, please remove all unused methods in this class.
self.enabled = True
def openDocument(self):
pythonaddins.MessageBox("blah blah blah TEST")
print "fake fake fake"
Any ideas here would be great. This is supposed to be the "easy" part as I haven't gotten into the complexities of my actual script that I'll be setting up at all.
FOLLOW UP:
Add ins are terrible to test. All testing must be done in the IDE as you are given no indication whatsoever what is wrong once you are working in ArcMap. I still have not really figured out all of the vagaries regarding why or why not something will not fire. For example, I have gotten the above script to run when I incorporate newDocument() above openDocument() with the same functional code, but if I then comment out newDocument it stops working. Nonsense.
It comes down to this: if you can see the Add in but not the Extension (assuming its an extension) then something is wrong with your script. However, I now have a new script which runs fine directly from the ArcMap immediate window but does nothing through the Add in. Nonsense. I suppose I'll just keep randomly guessing until it happens to work.