kiwiba12

Parameter Error in Python Toolbox

Discussion created by kiwiba12 on Nov 14, 2012
Latest reply on Jan 16, 2015 by SWalbridge-esristaff
Hey,

it's the first time, that I tried to create a Python Toolbox. Now I got this Error Message:

Traceback (most recent call last): File "<string>", line 51, in getParameterInfo File "c:\programme\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 286, in __init__ setattr(self, attrib, attribvalue) File "c:\programme\arcgis\desktop10.1\arcpy\arcpy\arcobjects\_base.py", line 87, in _set return setattr(self._arc_object, attr_name, cval(val))ValueError: ParameterObject: Invalid input value for DataType property

I have no idea, whats wrong- so please help me! Did I use the wrong separators for my paths, or is there another problem?

My code:

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

    def getParameterInfo(self):
        """Define parameter definitions"""

        p0 = arcpy.Parameter(
            displayName="Basis-DLM (Ebene Jahr auswählen)",
            name="pfad",
            datatype="DEFolder",
            parameterType="Required",
            direction="Input")

        p1 = arcpy.Parameter(
            displayName="Bundesland der Gemeinde",
            name="bula",
            datatype="GPString",
            parameterType="Required",
            direction="Input")
        p1.value = "hh"

        p2 = arcpy.Parameter(
            displayName="zugehörige VG25 (Geodatabase) wählen",
            name="vg25",
            datatype="DEWorkspace",
            parameterType="Derived",
            direction="Output")
        # Set the filter to accept only local (personal or file) geodatabases
        p2.filter.list = ["Local Database"]
        p2.value = r"M:\eingangsdaten\geodaten\endfassung\gebiete\VG25\2010\vg_25.gdb"
       
        p3 = arcpy.Parameter(
            displayName="Output Feature Class",
            name="out_fc",
            datatype="DEShapefile",
            parameterType="Required",
            direction="Output")
        p3.value = "D:\workspace\sie02_f_2010.shp"

        p4 = arcpy.Parameter(
            displayName="AGS der Gemeinde (Vorschlag = Hamburg)",
            name="ags",
            datatype="GPString",
            parameterType="Required",
            direction="Input")
        p4.value = "02000000"

        p5 = arcpy.Parameter(
            displayName="Workspace (optional)",
            name="ziel",
            datatype="DEWorkspace",
            parameterType="Optional",
            direction="Input")
        # Set the filter to accept only local (personal or file) geodatabases
        p5.filter.list = ["Local Database"]
        p5.value = "#"
       
        params = [p0, p1, p2, p3, p4, p5]  

        return params

Outcomes