AnsweredAssumed Answered

Python Toolbox no parameters

Question asked by granthay on May 1, 2018
Latest reply on May 1, 2018 by granthay

Hi All,

 

I've written a python script that I made into a tool, however I'd like to convert it over to a python toolbox for additional control of the tool interface. I'm fairly new to python and arcgis so I started by creating my tool parameters, and no matter what I try or how many times I check my syntax and other geonet threads I keep getting an error message that reads the tool has no parameters.

 

import arcpy

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 = "Toolbox"

      # List of tool classes associated with this toolbox
      self.tools = [Tool]


class Tool(object):
   def __init__(self):
      """Define the tool (tool name is the name of the class)."""
      self.label = "ALCOSAN"
      self.description = ""
      self.canRunInBackground = False

def getParameterInfo(self):

   param0 = arcpy.Parameter(
      displayName="Output Features",
      name="out_features",
      datatype="DEFeatureClass",
      parameterType="Required",
      direction="Output")

   param1 = arcpy.Parameter(
      displayName="Input Features",
      name="in_features",
      datatype= "GPValueTable",
      parameterType="Required",
      direction="Input")

   param1.columns = [["DEFeatureClass", "Input Layer"], ["GPDouble", "Relative Constraint"]]

   params = [param0, param1]

   return params

Outcomes