1

I am trying to identify and sum the lengths of line segments within a polygon boundary using the arcpy tool:

arcpy.SummarizeWithin_analysis('my_gdb.DBO.gridzones', 'my_gdb.DBO.lines', 'my_gdb.lines_within', 'KEEP_ALL', [['Shape.STLength()', 'SUM']], 'ADD_SHAPE_SUM', 'METERS', 'state', 'ADD_MIN_MAJ', 'ADD_PERCENT', 'my_gdb.DBO.inspection_percent') 

but when I run this in a stand-alone Python script, I get this error:

arcpy.SummarizeWithin_analysis(in_polygons, in_sum_features, out_feature_class, keep_all_polygons, sum_fields, sum_shape, shape_unit, group_field, addMinMaj, add_group_percent, out_group_table)
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\analysis.py", line 2265, in SummarizeWithin
    raise e
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\analysis.py", line 2262, 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 496, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Please refer to the error help for potential solutions, or contact Esri Technical Support http://esriurl.com/support.
Failed to execute (SummarizeWithin).

and when I run it from within ArcGIS Pro (with parenthesis around the feature class names), I get this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 2265, in SummarizeWithin
    raise e
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 2262, 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 496, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool

I am following the documentation verbatim, but cannot get this tool to work, and am not getting a concise error message to troubleshoot this issue.

  • Is it really `'my_gdb.DBO.lines' with the extra quote mark or is that an aberration that has crept in? Is the object my_gdb an enterprise database connection? Does the current user have permission to write a new table (CREATE permission)? Have you tried executing this tool from the toolbox? If it works there you can export a script from the results window and see where your objects aren't right. – Michael Stimson Feb 6 at 0:34
  • What happens when you run the Summarize Within tool from its dialog using the same parameters? – PolyGeo Feb 6 at 1:02
  • I truncated the schema name to 'my_gdb', and the parameters for SummarizeWithin_analysis are all in single quotes when I typed it in the Python window inside ArcGIS Pro, otherwise in the stand-alone Python script the parameters were set to variables and those were handed in. Yes, the database schema, owner, and features all exist within the enterprise database, except for the outFeature ('my_gdb.DBO.inspection_percent' in Pro code, a parameter in the stand-alone code), and yes, the user has create permissions. I'll try running through the toolbox and see if that works... – m.Walker Feb 6 at 2:34
  • Nope, same error as I got from the stand-alone Python script: Running script Summarize Within... ERROR 999999: Something unexpected caused the tool to fail. Please refer to the error help for potential solutions, or contact Esri Technical Support esriurl.com/support. Completed script Summarize Within... Failed to execute (SummarizeWithin). – m.Walker Feb 6 at 2:52
  • The parameters I entered into the arcToolbox tool were the same as the script and in ArcGIS Pro: a polygon feature, a line feature, a new output feature class, summary field of SHAPE.STLength(), a statistic of 'SUM', a shape unit of 'METERS', and a group field of 'state' (there are two states, inspected and <Null>) along with a outTable. For simplification, I removed the group field and outTable, but it still failed. All of these parameters were selected from the tool's own dropdowns, nothing manually typed in. – m.Walker Feb 6 at 2:59

Your Answer

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

Browse other questions tagged or ask your own question.