1

Using ArcGIS 10.2.1 and Python 2.7

My python addin works in ArcMap if I open ArcMap with the Python window open, but if I open ArcMap without the Python window open - I get a "MISSING" tool error. enter image description here See code below.

import arcpy
import pythonaddins
class IntersectionSearchCmb(object):
"""Implementation for IntersectionSearch_addin.combobox (ComboBox)"""
def __init__(self):
 arcpy.AddMessage("HERE I AM 1")
 print "Here i am 1"
 cur,row = None, None
 self.street_list = []
 self.street_dict = {}
 self.street_list.append("Battle St at 6th Ave")
 self.street_list.append("6th Ave at Battle St")
 self.street_dict["Battle St at 6th Ave"] = [688855.366,5616889]
 self.street_dict["6th Ave at Battle St"] = [688855.366,5616889]
 self.street_list.sort()
 #self.street = list(set(self.street))
 self.items = self.street_list
 self.editable = True
 self.enabled = True
 self.width = 'WWWWWWWWWWW'
 self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWWWWWWWW'
def onSelChange(self, selection):
 arcpy.AddMessage("HERE I AM 2")
 print "Here i am 2"
 self.mxd = arcpy.mapping.MapDocument('current')
 self.df = arcpy.mapping.ListDataFrames(self.mxd)[0]
 try:
 x = self.street_dict[selection][0]
 y = self.street_dict[selection][1]
 extent = arcpy.Extent(x,y,x,y)
 self.df.panToExtent(extent)
 self.df.scale = 1500
 arcpy.RefreshActiveView()
 except:
 pass
def onEditChange(self, text):
 pass
def onFocus(self, focused):
 arcpy.AddMessage("HERE I AM 3")
 print "Here i am 3"
 self.mxd = arcpy.mapping.MapDocument('current')
 self.df = arcpy.mapping.ListDataFrames(self.mxd)[0]
 pass
def onEnter(self):
 pass
def refresh(self):
 pass
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jun 21, 2017 at 20:27
6
  • Please add the text of the error message you are receiving. Commented Jun 21, 2017 at 20:46
  • I am not recieving an error message - just the tool within ArcMap is shown as [Missing]. No errors. I have attached the screen shot of the error in the original question now. Commented Jun 21, 2017 at 20:48
  • 1
    I think your config.xml and ArcPy code may be out of sync. Commented Jun 21, 2017 at 20:51
  • Any ideas on how to test this? I have re-compiled it, but perhaps I need to re-create it from scratch? Commented Jun 21, 2017 at 20:57
  • 1
    Does it work on another machine? I have seen this before - addin icons showed on several computers and didn't show on several others. Commented Jun 21, 2017 at 21:09

1 Answer 1

1

Found the answer to my own question: the file C:\Python27\ArcGIS10.2\Lib\site-packages\desktop10.2.pth wasn't structured correctly. It was missing these 3 lines:

c:\Program Files (x86)\ArcGIS\Desktop10.2\bin

c:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy

c:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Scripts

Once these lines were added to the desktop10.2.pth file - everything worked correctly. I think our Python was installed incorrectly. Thanks for all your suggestions!

answered Jun 23, 2017 at 20:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.