Union analysis fails to execute

2625
11
Jump to solution
09-13-2012 08:51 PM
RichardThurau
Occasional Contributor
Anyone see what's causing this tool to fail?


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))


Error Code:
inList: [u'Road_ProcGrid_1', u'FPs_S_ProcGrid_1', u'er_di_ProcGrid_1', u'TV_v_ProcGrid_1']

Traceback (most recent call last):
  File "E:\Projects\TV\01_Python\LandCover\LC_2_Vector_Tile_6class_091312.py", line 48, in <module>
    arcpy.Union_analysis([InList], ws + "/" + "TVvis6class_G" + str(i))
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 483, in Union
    raise e
RuntimeError: Object: Error in executing tool
>>>



It's making a good list. I've tried messing with the output format.

Any suggestions, much appreciated!!

Rich
Tags (2)
0 Kudos
11 Replies
ChristopherThompson
Regular Contributor

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.

XanderBakker
Esri Esteemed Contributor

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).