Select to view content in your preferred language

Better debug tutorials for toolbox

519
0
07-05-2022 09:38 PM
Status: Open
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)