.pyt file has red x

1772
2
08-23-2016 11:18 AM
ToddTurner1
New Contributor

I'm trying to add a .pyt toolbox file to the ArcToolbox.  When browsing to the .pyt file to add it, it has a red x on the icon.  Once selected and Opened, it won't add the toolbox/tools to the ArcToolbox list.  It added fine last week.

0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor

Using the ArcMap Catalog window (or ArcCatalog itself), browse to the offending pyt (don't use the ArcToolbox -> Add Toolbox dialog for this test).


Does the toolbox have the "X" or the tools inside?
i.e
toolbox and tool errors 

If it's the toolbox (pyt) - right click on the .pyt and select "Check syntax...".

If it's the tool - right click on the tool and select "Why...".

Post the output (as text, not screenshot).

0 Kudos
XuewenZhang
Esri Contributor

I also have this question when trying to add my Python Toolbox to ArcMap. ArcMap is using Python 2.x, so that it's a bit different from ArcGIS Pro and there is also some strict limit. I finally fixed this issue by checking two aspects: Syntax and Encoding.

1. Syntax Errors

Please make sure there are no syntax errors before adding to ArcMap.

2. Encoding

Please make sure the encoding of your *.pyt is correct (Python 2.x needs you to define the encoding). You can use all English characters or adding an encoding at the header of the file.

0 Kudos