I have been posting similar questions recently, but I found a template code for a Python toolbox and I would like more help.
I am trying to create a tool in ArcGIS Pro that takes parameters from users (initially, the geodatabase filename) and shows the report on the screen.
I added to the template the function "getParameter." I thought this function will open up a dialog box for a user to choose a parameter, but it does not for some reason.
The following code has no syntax error. When I add a new Python toolbox and ran this code, it does run, but it says "no parameters," as the screenshot says. What change do I need to make?
import arcpy
import os
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
self.alias = ""
# List of tool classes associated with this toolbox
self.tools = [Report]
class Report(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Tool"
self.description = ""
self.canRunInBackground = False
def getParameter(self):
arcpy.env.workspace = arcpy.GetParameterAsText(0)
featureclasses = arcpy.ListFeatureClasses()
for fc = in featureclasses:
print (fc)
def getParameterInfo(self):
"""Define parameter definitions"""
params = None
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, parameters, messages):
"""The source code of the tool."""
return