Python toolbox runtime debugging needed

12-11-2012 01:12 PM
Status: Implemented
Labels (1)
MVP Esteemed Contributor
Currently if a Python toolbox causes an error on import, it shows up in the tool listing with a red x.

If it's a syntax error, fine enough, that has been handled in the interface. However, if it's a runtime error, there's a red X but no way to check it. The only way i can check it is to copy the .pyt to .py and try to import it.

As an example, I created an empty pyt in ArcCatalog and modified it slightly. This has no syntax errors, but I get a red X because the code fails when ArcCatalog tries to load it:


It would be great to have a tool or functionality that does a runtime check of .pyt files by attempting an import and reporting any runtime errors.
The geoprocessing team posted a blog post just on this topic!
In the specific scenario you described above you should be able to right-click the tool and select "Why" this will bring up a dialog box that will print the exception that was raised.

Traceback (most recent call last):
File "<string>", line 21, in __init__
ImportError: No module named foo
Status changed to: Implemented

This is implemented in ArcGIS Pro. When a tool fails at runtime, hover over the error banner to view the error messages.