2

enter image description here

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.

1
  • 3
    You have 5 input parameters in the code but only 4 in the script parameters. They must match in number and order/index. Commented Jul 3, 2017 at 10:58

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.