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.

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Jul 3, 2017 at 9:27
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.

answered Jul 3, 2017 at 11:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.