I am writing a script to be included in a toolbox but every time I am getting an error when I try to include the parameter using GetParameterAsText()
.
import numpy
from arcpy import env
from arcpy.sa import *
input_raster= arcpy.GetParameterAsText(0)
inputFeature= arcpy.GetParameterAsText(1)
clipRaster = arcpy.GetParameterAsText(2)
floodedArea = arcpy.GetParameterAsText(3)
output_folder = arcpy.GetParameterAsText(4)
and the error I get is...
Traceback (most recent call last):
File "C:\Python27\dealingwithraster.py", line 16, in <module>
output_folder =arcpy.GetParameterAsText(4)
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\__init__.py", line 655, in GetParameterAsText
return gp.getParameterAsText(index)
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\geoprocessing\_base.py", line 226, in getParameterAsText
self._gp.GetParameterAsText(*gp_fixargs(args, True)))
RuntimeError: Object: Error in getting parameter as text
Failed to execute (dealingWithRaster).
Help needed because I can't seem to figure out the problem.
-
3You have 5 input parameters in the code but only 4 in the script parameters. They must match in number and order/index.Bera– Bera2017年07月03日 10:58:04 +00:00Commented Jul 3, 2017 at 10:58
1 Answer 1
You have 5 input parameters in the code but only 4 in the script parameters. They must match in number and order/index.
You are missing floodedArea
in the script parameters.
Explore related questions
See similar questions with these tags.