AnsweredAssumed Answered

Error in using arcpy.SetParameterAsText

Question asked by jbridwell156 on Mar 22, 2018
Latest reply on Jul 26, 2018 by vshah6

Hey All,

     I am trying to create a derived output using a Python script. when I run the script, I keep getting the following error:

"RuntimeError: Object: Error in setting parameter as text". I have an output folder that is an input (outFolder). I basically want to use that same folder as an output once the script has run so that I can use it in a model.

My parameters are set up like this: 

input_FC = arcpy.GetParameterAsText(1)
inField = arcpy.GetParameterAsText(2)
theFName = arcpy.GetParameterAsText(3)
outFolder = arcpy.GetParameterAsText(4)
output = arcpy.SetParameterAsText(5, outFolder)
script = sys.argv[0]

 

I have tried several variations of SetParameterAsText, including:

        outFolder = arcpy.SetParameterAsText(5, "outFolder")

        and

        arcpy.SetParameterAsText(5, outFolder)

         

My parameter named "output" is configured as such in the script tool properties:

Screenshot of my parameter settings

 

It is set to derived so that it will appear as an output in a model and obtained from the input parameter, outFolder (Named Feature Class in the parameter settings above). What am I doing wrong here?

Outcomes