darylej

GetParameterAsText  "ERROR 000735: Input Features: Value is required"

Discussion created by darylej on Nov 29, 2011
Latest reply on Dec 20, 2011 by emerickr
I cannot get this code to work. It is a simple homework assignment- I saw a similar post that I quote below but my problem is slightly different as I wrote the code as script not exported from a model :

I am trying to use the GetParameterAsText to ask the user to give input (to let them choose which featureclass they want to use) from the script. I keep getting the message : "Runtime error <class 'arcgisscripting.ExecuteError'>: ERROR 000735: Input Features: Value is required"

I cannot get the box to come up asking the user to choose which featureclass to run the script/model on or the output file etc.
Previous poster added the script as a tool and made parameters there but I need to code them from script for this homework- the script works if I hardcode the inputs.

    CODE:
# Purpose: Copy selected features from one feature class into
#          a brand new feature class.

# Import the arcpy module
import arcpy, os.path

# Input feature class.
inFC = arcpy.GetParameterAsText(0)
# Output feature class.
outFC = arcpy.GetParameterAsText(1)
# SQL statement to filter features. If the expression is empty,
# all features will be copied into the new feature class.
expression = arcpy.GetParameterAsText(2)
# Field information to alter output fields. If the fieldInfo
# is empty, all fields will be unaltered in the new feature class.
fieldInfo = arcpy.GetParameterAsText(3)

# Make a temporary layer to hold the selected features and altered fields.
# The selected features are determined by the expression variable.
# The altered fields are determined by the fieldInfo variable.
arcpy.MakeFeatureLayer_management(inFC, os.path.basename(outFC), expression,
                               os.path.dirname(outFC), fieldInfo)

# Copy selected features and altered fields to the output feature class.
arcpy.CopyFeatures_management(os.path.basename(outFC), outFC)

Outcomes