Hello,
Currently using arcpy to run a script to include the Summarize Within tool. Unfortunately, I am receiving a 10014 error. I have already shortened the file path per the help article to the shortest possible and no luck. Seems like there is more to this than the 10014 error. Any help is appreciated.
I am using Python 3.7.11 with arcpy 2.9.
This is the error received:
Traceback (most recent call last):
File "D:/Python/PlanningTools/KABCO.py", line 97, in <module>
summarize = arcpy.analysis.SummarizeWithin(buffer, sc_input, ee, keepAll, sumFields)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\analysis.py", line 2686, in SummarizeWithin
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\analysis.py", line 2683, in SummarizeWithin
retval = convertArcObjectToPythonObject(gp.SummarizeWithin_analysis(*gp_fixargs((in_polygons, in_sum_features, out_feature_class, keep_all_polygons, sum_fields, sum_shape, shape_unit, group_field, add_min_maj, add_group_percent, out_group_table), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 100014: Summarize Within failed.
Failed to execute (SummarizeWithin).
And the error code support article - https://support.esri.com/en/technical-article/000027089
import arcpy
import pandas as pd
import os
arcpy.env.overwriteOutput = True
#create folder and gdb
PD_num = "Test_v1"
Folder_v1 = arcpy.env.workspace = r"D:\Python"
Folder_A = arcpy.management.CreateFolder(out_folder_path=Folder_v1, out_name="{}".format(PD_num))
print("Folder named {} created".format(PD_num))
Summary_gdb = arcpy.management.CreateFileGDB(out_folder_path=Folder_A, out_name="Summary", out_version="CURRENT")[0]
#some inputs
crash = r"D:\Python\PlanningTools\KABCO\Data\stafford_crash"
crash_input = arcpy.FeatureClassToFeatureClass_conversion(crash,Summary_gdb,"crash")
segments = r"D:\Python\PlanningTools\KABCO\Data\SegmentTest\Segment_Test.shp"
segment_input = arcpy.FeatureClassToFeatureClass_conversion(segments,Summary_gdb,"segments")
#Create buffer
buffer = arcpy.analysis.Buffer(segment_input, os.path.join(Summary_gdb, "segments_buffer"), "35 Feet", "FULL", "ROUND", "NONE", None, "PLANAR")
#add fields
a = arcpy.management.AddField(crash_input, "A_crashes", "LONG", None, None, None, '', "NULLABLE", "NON_REQUIRED", '')
b = arcpy.management.AddField(crash_input, "B_crashes", "LONG", None, None, None, '', "NULLABLE", "NON_REQUIRED", '')
c = arcpy.management.AddField(crash_input, "C_crashes", "LONG", None, None, None, '', "NULLABLE", "NON_REQUIRED", '')
k = arcpy.management.AddField(crash_input, "K_crashes", "LONG", None, None, None, '', "NULLABLE", "NON_REQUIRED", '')
o = arcpy.management.AddField(crash_input, "O_crashes", "LONG", None, None, None, '', "NULLABLE", "NON_REQUIRED", '')
#Calculate fields
aa = arcpy.management.CalculateField(crash_input, "A_crashes", "reclass(!CRASH_SEVE!)", "PYTHON3", """def reclass(CRASH_SEVE):
if (CRASH_SEVE == "A"):
return "1"
else:
return "0"
""", "TEXT", "NO_ENFORCE_DOMAINS")
bb = arcpy.management.CalculateField(aa, "B_crashes", "reclass(!CRASH_SEVE!)", "PYTHON3", """def reclass(CRASH_SEVE):
if (CRASH_SEVE == "B"):
return "1"
else:
return "0"
""", "TEXT", "NO_ENFORCE_DOMAINS")
cc = arcpy.management.CalculateField(bb, "C_crashes", "reclass(!CRASH_SEVE!)", "PYTHON3", """def reclass(CRASH_SEVE):
if (CRASH_SEVE == "C"):
return "1"
else:
return "0"
""", "TEXT", "NO_ENFORCE_DOMAINS")
dd = arcpy.management.CalculateField(cc, "K_crashes", "reclass(!CRASH_SEVE!)", "PYTHON3", """def reclass(CRASH_SEVE):
if (CRASH_SEVE == "K"):
return "1"
else:
return "0"
""", "TEXT", "NO_ENFORCE_DOMAINS")
ee = arcpy.management.CalculateField(dd, "O_crashes", "reclass(!CRASH_SEVE!)", "PYTHON3", """def reclass(CRASH_SEVE):
if (CRASH_SEVE == "O"):
return "1"
else:
return "0"
""", "TEXT", "NO_ENFORCE_DOMAINS")
#inputs for summarize within
sc_summary = os.path.join(Summary_gdb, "sc")
keepAll = 'KEEP_ALL'
sumFields = [['A_crashes', 'Sum'], ['B_crashes', 'Sum'], ['C_crashes', 'Sum'], ['K_crashes', 'Sum'],['O_crashes', 'Sum']]
sc_input = arcpy.FeatureClassToFeatureClass_conversion(ee,Summary_gdb,"crash_input")
#summarize within
summarize = arcpy.analysis.SummarizeWithin(buffer, sc_input, ee, keepAll, sumFields)
print (Summary_gdb)
print ("Script complete")
I was running into the same issue with the error still occurring after shortening the file path name. I ended up finding that one of the field names in one of the involved feature classes had too long of a name (discovered this as I tried another tool using the same involved feature classes and that tool had more specific error messages). After I shortened the field name, I found that I was able to get the summarize within to work. This may not be the issue you are having but it is worth checking since it appears to be another issue that leads to the 10014 error.