How to enable Python toolbox debug menu item?

1119
9
01-18-2018 03:04 PM
MarkMindlin
Occasional Contributor III

Hi,

We just wonder why the Python toolbox debug menu item disabled? ArcCatalog 10.3.1.

0 Kudos
9 Replies
DanPatterson_Retired
MVP Esteemed Contributor

In arcmap 10.6 Editing a Python toolbox

in arcmap 10.3 Editing a Python toolbox

But in newer versions you can Encrypt a Python toolbox

Is there a chance that you have a new version of the toolbox?

0 Kudos
MarkMindlin
Occasional Contributor III

Thank you Dan,

The current version is 10.3.1

My question - how to enable "Debug" menu item?

Unfortunately, I cannot see any explanation in links you provided.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Well, it appears you have the script enabled and it can't be put into edit mode.

Which leaves, moving up one level and see if selecting the actual toolbox will enable you to edit it first.

If neither of those work, I would try this when the toolbox is added to arctoolbox rather than doing it from arccatalog.

And my final question, was whether it was a toolbox that was yours, or you got from somewhere else, that might be in a higher version, but encrypted.  I know that you were using arccatalog 10.3, but the source/origin of the toolbox wasn't obvious.

Addendum

Click on Properties and report what is there as well.  I am assuming that the script actually exists from the looks of it, but that is hidden.

0 Kudos
MarkMindlin
Occasional Contributor III

Dan,

Could you please explain what is "the script enabled".

Moving up one level allows us to edit

It is my Python toolbox. Just created. 

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

exactly... in your first image the script was selected (enabled in other terms) and in your second image, the toolbox can now be edited.  That is what I wanted to see.

Now, I prefer regular toolboxes, so your toolbox has other options so try them... ie refresh, check syntax, edit and properties. Does anything allow you to edit the script you created?

0 Kudos
MarkMindlin
Occasional Contributor III

 "it appears you have the script enabled and it can't be put into edit mode."

What time I will have "Edit" and "Debug" menu item enabled?

My main question is about "Debug".

Or it is one more ESRI "as designed"? (strange logic, never used functionality, should be supported in future releases)

 

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

we are fighting against version information I suppose

From here http://pro.arcgis.com/en/pro-app/arcpy/geoprocessing_and_python/comparing-custom-and-python-toolboxe...

Debugging

Custom toolboxesPython toolboxes

IDEs can only debug Python files (.py). For Python code in script tool validation (embedded within a toolbox) the following approach can be used: copy the code to an external Python file and replace the code in the Python toolbox with the example below. You can then open the Python file in your IDE and set breakpoints, attach the IDE to ArcGIS Pro, and run your script tool. Upon completion of code modification, copy the contents of the Python file back into the tool validation.

IDEs can only debug Python files (.py). For code in a Python toolbox (.pyt file) the following approach can be used: copy the code to an external Python file, and replace the code in the Python toolbox with the example below. You can then open the Python file in your IDE and set breakpoints, attach the IDE to ArcGIS Pro, and use your Python toolbox. Upon completion of code modification, copy the contents of the Python file back into Python toolbox.

Which explains why you can't edit in Pro, so I presume that is the same case for your version of arcmap.

so it appears perhaps, that the process for Python toolboxes makes 'debug' and 'edit' a bit of an 'as designed' and your other bracketed comments

0 Kudos
MarkMindlin
Occasional Contributor III

Thanks Dan.

It is "as designed"

0 Kudos
AlessandroValra
Occasional Contributor III

Hi everybody,

sorry to jump in late but here is what I normally do when debugging python toolboxes (it works great!).

How to Debug Python Toolboxes in 3 Easy Steps | ArcGIS Blog 

0 Kudos