My script works fine with a single feature class selected for clip_fc = arcpy.GetParameter(0) .

However when I set clip_fc to MultiValue in the script properties and then select several feature classes, I get an error "Parameters are not valid.".

Can anyone show me where I am going wrong?

import arcpy
import os.path
from arcpy import env

arcpy.env.workspace = r"C:\GIS Home\project_1\clipshps\Combined_mf.gdb"
arcpy.env.overwriteOutput = True
clip_fc = arcpy.GetParameter(0)
clip_name = str(clip_fc)
output_dir = r"C:\GIS Home\project_1\clipshps\outputs_clip"

for fds in arcpy.ListDatasets():
    for fc in arcpy.ListFeatureClasses('','',fds):
        out = os.path.join(output_dir, fc + "_" + clip_name[40:] + "_clip.shp")
        arcpy.Clip_analysis(fc, clip_fc, out, "")
  • 1
    Could you put up the script with fc_list in it to see how you're using it?
    – om_henners
    Commented Oct 11, 2012 at 16:04
  • hi @om_henners Sorry I corrected my question, should make more sense now.
    – Matt
    Commented Oct 11, 2012 at 17:39
  • Related: gis.stackexchange.com/questions/9406/…
    – Roy
    Commented Oct 11, 2012 at 17:51

2 Answers 2


You need to loop through your inputs. Multivalue is semicolon delimited. Split on that and loop through them. (AddMessages to show how the fcs are presented)

import arcpy

ins = arcpy.GetParameterAsText(0)

for fc in ins.split(';'):
    arcpy.Clip_analysis(fc, clipfeats, out)

Though I'm not entirely sure of your workflow. You're passing in multiple features to clip on, but also iterating through multiple features in a GDB? You'll have to take the logic I placed above and figure out what combination of inputs you want (1 or many FCs inside a GDB + 1 or many inputs to your tool)

EDIT ...Based on your comment you want many feature classes clipped by many feature class. Try this mash up of code based on yours and mine:

import arcpy, os

ins = arcpy.GetParameterAsText(0)

arcpy.env.workspace = r"C:\GIS Home\project_1\clipshps\Combined_mf.gdb"
output_dir = r"C:\GIS Home\project_1\clipshps\outputs_clip"

for fds in arcpy.ListDatasets():

    # will loop for every featureclass
    for fc in arcpy.ListFeatureClasses('','',fds):            

        # will loop for each input fc from the tool
        for fc_clip in ins.split(';'):
            outName = os.path.join(output_dir, str(os.path.basename(fc)) + "_" + str(os.path.basename(fc_clip)))
            arcpy.Clip_analysis(fc, fc_clip, outName, "")
  • 2
    Here is a link to the ESRI Script Tool Parameter Help Files. They offer a code example too.
    – Roy
    Commented Oct 11, 2012 at 17:50
  • Thanks @KHibma Looking at your answer I think I am going about this the wrong way. I have a geodatabase containing a number of feature classes, and I want to clip each feature class several times using different shapefiles.
    – Matt
    Commented Oct 11, 2012 at 19:17
  • @KHibma tried that and got 'clip1 does not exist or is not supported'
    – Matt
    Commented Oct 11, 2012 at 20:54
  • Ummm it works fine for me? only thing I can think is the output dir. You may need to add ".shp" to the end of your outname as its a folder, not a gdb.
    – KHibma
    Commented Oct 11, 2012 at 22:57
for fc in arcpy.GetParameterAsText(0).split(";"):
arcpy.AddMessage("No more shapefiles")

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.