Select to view content in your preferred language

Python Toolbox no parameters

2045
3
05-01-2018 12:51 PM
GrantHaynes
Regular Contributor

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

Tags (2)
0 Kudos
3 Replies
JamesMacKay3
Frequent Contributor

Hi Grant, after making changes have you refreshed your toolbox's contents in ArcCatalog or the ArcMap Catalog window?  I copy/pasted your code and it worked right away:

GrantHaynes
Regular Contributor

Yes, I refreshed it every time I made changes, but every time it said "no parameters"

GrantHaynes
Regular Contributor

Yes, constantly, but it kept coming up with "no parameters" every time.

0 Kudos