I'm tagging Rebecca because of the conversation here: Custom toolbar that contains Python Scripts
I have been playing with the Python Add-In Wizard, and I have created a toolbar with some menus and buttons. I am having trouble getting the buttons to work, though. I've followed Rebecca's instructions (here: Python add-ins vs. .NET add-ins?), as well as the attached PDF to try and use an existing python script within my toolbox, but the button just shows up as missing when I install the add-in and run ArcMap. I've even tried pasting the entire code from the script directly into the onClick function, and that just does the same thing.
Is this a common problem? Is this indicative of a common issue, or could it be a vague error that would be harder to diagnose...? I read somewhere that the missing designation could mean that there is some sort of syntax error in the code, but the scripts work on their own...just not whenever I try to associate them with a button on the custom add-in toolbar.
Thanks you!
Well, that's good. Now you can write arcpy scripts that run outside of ArcMap.
I'd suggest calling ESRI tech support. Without being able to remote into your computer, it's hard to troubleshoot.
However, I've personally only seen the Missing icons in two instances:
Good luck!
Yeah, I actually just contacted support via email about 10 minutes ago lol. In this instance, if it's one of the two that you have experienced the problem in, my bet is an environment variable issue.
After my scripts weren't working yesterday, all I have been testing with now is the very basic MessageBox that I pasted in a response above. Everything else in the *_addin.py file is the default script that is generated once you create the add-in project.
Thanks for your recommendations, though! I appreciate it.
I have addins with both version 10.1 and 10.3 in the config.xml, so I don't think that is an issue.
I did notice though that your id= values don't match the "class" names in the original <project>_addin.py file
I think ButtonClass1 is the default, and in your _addin.py file you show map_to_kml You may have more than that that isn't showing. I have those two items batch in my addins.
Also, just fyi, most have mine have been for Catalog, not ArcMap, so there may be things I haven't run into.
Try to see if making thing match up helps.
The mismatching is due to me creating a whole new project thinking that there may have been an error somewhere down the line that I didn't notice. I created a whole new project so that the *_addin.py file would be default (thinking that the default file would eliminate any syntax errors). I've been using the MessageBox example as shown above just to test, but the button still shows as missing even if I don't add the MessageBox function. I can generate a completely default *_addin.py file, create/install the add-in, and ArcMap still shows a missing button. There can't be any syntax errors if I haven't even typed anything into the file...something has to give here lol.
Thank you for your recommendations and assistance as well. I appreciate the efforts.
Ha, ya some things are head scratchers. Make sure to come back and summary if you find an answer. MArk any of the above if they were helpful, and then mark the questions a assumed answered if none was a complete answer.
Good luck. I'll still try to get you a sample later today if you haven't resolved it yet....but I'm knee deep into getting my last script to do all I want (close, but not quite).
I will circle back and summarize what I find once a solution has been determined. No rush on getting any files to me. I believe I will move on to something else and give this a rest until support reaches out. Maybe the break will do some good .
I believe that I may have found the issue. I was tinkering just a bit more and found that the button was working, and I realized that the one that was working was one that was created inside a project folder that contained no spaces.
I created an identical project inside of two separate folders ("test_addin" and "test addin"). The button inside of "test_addin" worked, while the button that was inside of "test addin" did not. Can either of you confirm that the spacing in the project folder does indeed affect the add-in?
I can't confirm for sure, but I make sure I don't have spaces as a matter of practice. Spaces can mess many things up, especially in path names.
Coy, I wanted to point you to the addin I was working on....I put in in a blog post if you want to take a look. I'll be away from the office for a couple weeks, so can answered questions but won't be able to repost.
Python addin for data inventory and “broken-link” repair.
I was was getting frustrated for a while since it appeared that my toolbox kept switching to 10.3 even though I saved it as 10.1 ...built it in 10.2, etc. most of my tools would not even show in the 10.2 toolbox. I figured out my issues and wanted to mention here, just in case anyone else ran into the. Some of my scripts were started with comments with three double quotes instead of three single quotes. The double quotes were causing the tools not to be seem in 10.2.2.
hope you were able to get your addin working.