Gridnums = range(1,18) for i in Gridnums: #vis6class = ws + "/" + "TVvis6class_G" + str(i) inList = arcpy.ListFeatureClasses("*ProcGrid_"+str(i), "") print "inList: " + str(inList) arcpy.Union_analysis(InList, ws + "/" + "TVvis6class_G" + str(i))
Solved! Go to Solution.
Reading help on the union command (v10.1 ArcGIS Help 10.1 ) it does say that the input features argument is a list, and shows the proper formatting as a Python list which is enclosed in square brackets - this is also true of v10.0. This is confusing somewhat because the way this is depicted in the help doc is somewhat ambiguous. Help for earlier versions of ArcGIS (v9.3 ArcGIS Desktop Help 9.3 - union (analysis) ) also speak of the input_features argument as being a list but doesn't appear to require this to be formatted as a Python list - makes me think that the tool had a process working in the background to create a Python list from the user supplied input. Ultimately its better that the language in the tools and help are more aligned with the Python terminology so when reference is made to a list it is truly meant to a Python list which has a specific meaning when scripting the command, but it would be nice if this was more clearly stated for those who have worked with legacy products.
One thing that I would advise, in case there is any doubt about how the parameters should be provided, is to execute the tool manually and copy the python code from the Results window. This shows how the parameters should be provided. In case you feel that the help does not reflect clearly how things the tool should be used, you can use the "Feedback on this topic" link in the lower right part of the Help topic. I have used it several times and Esri has responded very fast (mostly the same day).