Select to view content in your preferred language

Better debug tutorials for toolbox

883
3
07-05-2022 09:38 PM
Status: Implemented
HildermesJoséMedeirosFilho
Occasional Contributor

I found the hard way that debuging a pyt could be very script like.


class Toolbox(object):
///Toolboxcode and Classes

def
debug():
"""
Debug with pydevd (I use pycharm but people could just change the aproach)
"""
tbx = Toolbox()
tool = ToolboxLabel()
print('Debugging tool: {}'.format(tool.label))
debug_folder = os.path.dirname(__file__)
params = tool.getParameterInfo()
params[0].value = os.path.join(debug_folder, "test")
params[1].value = os.path.join(debug_folder, 'test', "docs") #os.path.join(debug_folder, 'testes', "pdfs")
params[2].value = "CE"#"PI"
params[3].value = 50
params[4].value = os.path.join(debug_folder, 'test', 'temp')
params[5].value = os.path.join(debug_folder, 'test', "test.shp")
tool.execute(params, None)


if "__main__" == __name__:
if "pydevd" in sys.modules:
debug()

A more modern official debug
doc/Tutorial it would be appreciated.

Tags (2)
3 Comments
HannesZiegler
Status changed to: Under Consideration

You've got our attention!  We think this is a good suggestion and have entered it in our backlog.  This does not guarantee that the idea will be developed so we encourage the community to continue voting and sharing feedback which will help teams gauge user demand. 

HannesZiegler
Status changed to: In Product Plan

We're working on this!  This status does not guarantee that the functionality will be in the next release, but development work has begun. Release cycles vary by product so make sure to check the product life cycle information to get an idea of when to expect the next release.  

HannesZiegler
Status changed to: Implemented

We have updated the documentation for debugging script tools and Python toolboxes with the release of ArcGIS Pro 3.5,

Debug Python code—ArcGIS Pro | Documentation

The documentation now provides more detailed information & instructions for debugging with Visual Studio and Visual Studio Code. 

We have also released the ArcGIS Pro Debugger Extension for Visual Studio Code (a free to use IDE) to improve the experience and accessibility of debugging script tools and Python toolboxes,

Debug ArcGIS Pro python tools in VS Code using Att... - Page 2 - Esri Community