0

I have a list of a 2 layers (nfhl_fld_haz_features, prelim_fld_haz_features) and a feature class (master_merge) that I want to perform a union on:

 wkflw2_union = arcpy.Union_analysis([master_merge, nfhl_fld_haz_features, prelim_fld_haz_features], wkflw2_union_output)

I keep getting the following error:

Traceback (most recent call last):

File "", line 1, in wkflw2_union = arcpy.Union_analysis([master_merge, nfhl_fld_haz_features, prelim_fld_haz_features], wkflw2_union_output)

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\analysis.py", line 734, in Union raise e

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\analysis.py", line 731, in Union retval = convertArcObjectToPythonObject(gp.Union_analysis(*gp_fixargs((in_features, out_feature_class, join_attributes, cluster_tolerance, gaps), True)))

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 496, in return lambda *args: val(*gp_fixargs(args, True))

RuntimeError: Object: Error in executing tool

I don't see any issue with using a list, but could this error be due to using a feature class mixed with 2 layers? Or could this be something else (the main files come from a network drive)

  • To confirm, all three inputs are polygons? (And you can perform a test with your union to answer the question about mixing feature classes and layers by making a layer from the third input.) – smiller Oct 16 '18 at 13:59
  • Yes, they are all polygons. I've got a suspicion that this is some kind of network or server issue related to grabbing the files. I've had a similar issue before where someone else was accessing the same source file and a Runtime Error was thrown. – gwydion93 Oct 16 '18 at 14:51
1

I think it would be better to have parameters like file paths in input list. As far as understood master_merge is something like r"D:\work\file.gdb\master_merge" and let it be like this.

Paths to layers can be obtained with Describe function and catalogPath method. So you have:

master_merge = r"D:\work\file.gdb\master_merge"
wkflw2_union_output r"D:\work\file.gdb\union_out"

nfhl_fld_fc = arcpy.Describe('nfhl_fld_haz_features').catalogPath
prelim_fld_fc = arcpy.Describe('prelim_fld_haz_features').catalogPath

wkflw2_union = arcpy.Union_analysis([master_merge, nfhl_fld_fc, prelim_fld_fc], wkflw2_union_output)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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