Addin Problem

4042
4
02-25-2015 11:52 AM
PROBERT68
Frequent Contributor

Hi evreyone,

I am working on this exercise I am not sure of...but I believe there is an error in it.

This is from the Programming ArcGIS 10.1 with Python cookbook on page 222 that says:

import arcpy
import pythonaddins
class ButtonClassImportWildfires(object):
"""Implementation for WildfireAddIn_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
pass

Does it seem correct to you ?

Then  it says:

Remove the pass statement from the onClick event.

In Chapter 7, you created a custom script tool that loads wildfire data from a text

file to a feature class. Inside the onClick event, call this Load Wildfires from Text

custom script tool so that it displays the user interface for selecting the text file,

template, and feature class to write to.

def onClick(self):

LoadWildfires_wildfire()

Save the file.

When I open that addin to my ArcMap and I can only see this :

Toolbar button missing.tif.png

Tags (2)
0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Robert,

One thing to check is to make sure you are preserving the indentation:

import arcpy  
import pythonaddins  
class ButtonClassImportWildfires(object):  
    """Implementation for WildfireAddIn_addin.button (Button)"""  
    def __init__(self):  
        self.enabled = True  
        self.checked = False  
    def onClick(self):  
        LoadWildfires_wildfire() 
0 Kudos
JoshuaChisholm
Occasional Contributor III

I had the same problem once. As Jake suggested, it was a problem with my code.

Here's a similar post: missing icon image for python addin

0 Kudos
PROBERT68
Frequent Contributor

When you add the python add in wizard, should it be saved under \USERS|your name|\Desktop\folder name ?

Can I save it anywhere in C hard drive ?

Thanks

0 Kudos
AlexanderNohe1
Occasional Contributor III

The Python addin wizard can be saved anywhere on your C Drive.  What I would recommend is that you test the code without the LoadWildfire thing first.  This could be that you are not loading the module that contains the wildfire method into your code.  If you test without that first and it works, it might be a missing module throwing that error.

0 Kudos