1

I'm getting a number of errors in the Python Window on ArcGIS 10.3.1 when going to Customize > Customize Mode... > (Commands Tab) as seen below. The majority of errors are coming from a Python Add-in:

>>> 
  File "<string>", line 1
    c:\arcgis\ArcToolbox\Toolboxes\Space Time Pattern Mining Tools.pyt
     ^
SyntaxError: invalid syntax
>>> 
>>> 
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'Search' object is not callable
>>> 
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'AddLayerfile' object is not callable
>>> 
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'ViewMetadata' object is not callable
>>> 
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'OpenPAPage' object is not callable
>>> 
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'QuickMap' object is not callable

The error about the space Time Pattern Mining Tools.pyt only shows after opening ArcMap and going to the Customize Menu, while the other errors show up every time I go to said Customize Menu (1-time error below).

>>> 
  File "<string>", line 1
    c:\arcgis\ArcToolbox\Toolboxes\Space Time Pattern Mining Tools.pyt
     ^
SyntaxError: invalid syntax

Oddly the path is incorrect, at least in a sense of existing. I have no "C:\ArcGIS" folder, and the Python Toolbox is actually installed here "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcToolbox\Toolboxes\Space Time Pattern Mining Tools.pyt" (unless it is using the "C:\arcgis" path as a universal.

I was getting this error on an existing toolbar, so I went ahead and attempted to recreate the toolbar, but before adding any scripting I the error showed up with the base set-up of the Add-In. Here is the code for that add-in:

import arcpy
import pythonaddins

class AddLayerfile(object):
    """Implementation for ToolbarRefresh_addin_addin.AddLayerfile (ComboBox)"""
    def __init__(self):
        self.items = ["item1", "item2"]
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
    def onSelChange(self, selection):
        pass
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass

class OpenPAPage(object):
    """Implementation for ToolbarRefresh_addin_addin.OpenPAPage (Tool)"""
    def __init__(self):
        self.enabled = True
        self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
    def onMouseDown(self, x, y, button, shift):
        pass
    def onMouseDownMap(self, x, y, button, shift):
        pass
    def onMouseUp(self, x, y, button, shift):
        pass
    def onMouseUpMap(self, x, y, button, shift):
        pass
    def onMouseMove(self, x, y, button, shift):
        pass
    def onMouseMoveMap(self, x, y, button, shift):
        pass
    def onDblClick(self):
        pass
    def onKeyDown(self, keycode, shift):
        pass
    def onKeyUp(self, keycode, shift):
        pass
    def deactivate(self):
        pass
    def onCircle(self, circle_geometry):
        pass
    def onLine(self, line_geometry):
        pass
    def onRectangle(self, rectangle_geometry):
        pass

class QuickMap(object):
    """Implementation for ToolbarRefresh_addin_addin.QuickMap (Button)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        pass

class Search(object):
    """Implementation for ToolbarRefresh_addin_addin.Search (ComboBox)"""
    def __init__(self):
        self.items = ["item1", "item2"]
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
    def onSelChange(self, selection):
        pass
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass

class ViewMetadata(object):
    """Implementation for ToolbarRefresh_addin_addin.ViewMetadata (ComboBox)"""
    def __init__(self):
        self.items = ["item1", "item2"]
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
    def onSelChange(self, selection):
        pass
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass

I set up the Add-In with the ESRI Add-In Assistant and used the following settings for each part of the toolbar:


-TOOLBARS

--ArcMap Tools [Toolbar] (Caption: ArcMap Tools; ID: ArcMapTools_addin.toolbar; [✓] Show Initially)

---SEARCH: [Combo Box] (Caption: SEARCH: ; Class Name: Search ; ID (Variable Name): ArcMapTools_addin.Search ; Tooltip: Search by Account Number)

---Add Layerfile: [Combo Box] (Caption: Add Layerfile: ; Class Name: AddLayerfile ; ID (Variable Name): ArcMapTools_addin.AddLayerfile ; Tooltip: Add Layerfile to TOC)

---View Metadata: [Combo Box] (Caption: View Metadata: ; Class Name: ViewMetadata ; ID (Variable Name): ArcMapTools_addin.ViewMetadata ; Tooltip: Select Feature Class to View Metadata)

---Open Page [Python Tool] (Caption: Open Page ; Class Name: OpenPage ; ID (Variable Name): ArcMapTools_addin.OpenPage ; Tooltip: Click in Parcel to Open Page) [Image for control set]

---Quick Map [Button] (Caption: Quick Map ; Class Name: QuickMap ; ID (Variable Name): ArcMapTools_addin.QuickMap ; Tooltip: Create Standard PDF Map Base) [Image for control set]


For the above settings, "SEARCH:", "Add Layerfile:", and "View Metadata:" all include Colons in their Caption setting.

Finally, I found the same issue being reported on here last year, however it did not include enough information. Someone suggested that the Python script with Syntax error should be fixed, however due to it being pre-installed Python Toolbox Script in ArcGIS, it is not editable (as far as I know).

  • 1
    Just a thought, may be your install of ArcMap has become corrupted in some way? You could try reinstalling it to see if that solves it. Note running a repair will blitz any customization you may have done. I suggest this as system tools generally behave, it's usually 3rd party tools that throw errors. – Hornbydd Sep 19 '17 at 16:08
  • I did do a reinstall very recently actually, because I was having issues with the Search window not showing up in ArcCatalog (and it still doesn't show, though looked it up and noticed it being a possible error fixed in 10.5.1 related to Win10). As an aside, I just had another user in my office run this, and she encountered the same error. – Gregory Mirth Sep 19 '17 at 17:39
  • What is a link to "the same issue being reported on here last year"? – PolyGeo Sep 19 '17 at 20:28
  • gis.stackexchange.com/questions/217846/… Here you go. – Gregory Mirth Sep 20 '17 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.