AnsweredAssumed Answered

Runtime Error with arcpy.Union_analysis()

Question asked by jbridwell_Dewberry on Oct 17, 2018
Latest reply on Oct 17, 2018 by Dan_Patterson

I am trying to run a union on a feature class (master_merge_footprints_20181011) and 2 temporary layers made from selected features (using select by attributes and then create layer from selection) from shapefiles (Prelim_S_Fld_Haz_Ar_13245 and  S_Fld_Haz_Ar)  

Here's the code snippet from the result (which worked):

arcpy.Union_analysis(in_features="Prelim_S_FLD_HAZ_AR_0637 #;Prelim_S_Fld_Haz_Ar_13245 #;'S_Fld_Haz_Ar selection' #;master_merge_footprints_20181011 #", out_feature_class="C:/Users/jbridwell/Documents/ArcGIS/Default.gdb/New_FLD_HAZ_AR_Union", join_attributes="ALL", cluster_tolerance="", gaps="NO_GAPS")

However, when I try a similar process in my script, I keep getting RuntimeError: Object: Error in executing tool. I though there might be a lock or something network related (the files are from a folder connection in a network drive) on one of the files, so I restarted my whole computer, but that was not the issue. Here is the traceback and the relevant portion of the code. Does anyone have any ideas as to what the problem might be or how to get it to run? Note: both 

Traceback: 

In [29] wkflw2_union = arcpy.Union_analysis(["master_merge_20181011", nfhl_fld_haz_features], "wkflw2_union_output", "ALL")

Traceback (most recent call last):

File "<ipython-input-28-37797fd2b95a>", line 1, in <module>
wkflw2_union = arcpy.Union_analysis(["master_merge_20181011", nfhl_fld_haz_features], "wkflw2_union_output", "ALL")

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 <lambda>
return lambda *args: val(*gp_fixargs(args, True))

RuntimeError: Object: Error in executing tool

Code:

wkflw2_union_output = "C:/Workspace/Sandbox/MapChangeProject/master_Map_Change_Report_App/gdb/selects.gdb/wkflw2_union_{}".format(today)
master_merge = "C:/Workspace/Sandbox/MapChangeProject/master_Map_Change_Report_App\gdb\selects.gdb\master_merge_footprints_{}".format(today)
wkflw2_union = arcpy.Union_analysis([master_merge, nfhl_fld_haz_features, prelim_fld_haz_features], wkflw2_union_output)

Outcomes