1

I am trying to use the Split by Attributes tool in arcpy to split a shapefile with 18 point features into 18 separate shapefiles. It works as expected in ArcGIS Pro, but when I run the following script, I get the error: arcgisscripting.ExecuteError: 'str' object has no attribute 'polygon'

import arcpy
arcpy.env.overwriteOutput = True
inputfc = r'C:\Users\Ian\Documents\ArcGIS\GIS test data\SJemezNamedSites.shp'
fieldname = 'short_name'
target_workspace = r'C:\Users\Ian\Documents\ArcGIS\GIS test data\output'
arcpy.SplitByAttributes_analysis(inputfc, target_workspace, fieldname)

Additionally, if I run the tool from ArcGIS Pro, and then choose to "Copy Python Command", I get:

arcpy.analysis.SplitByAttributes(r"C:\Users\Ian\Documents\ArcGIS\GIS test data\SJemezNamedSites.shp",
                             r"C:\Users\Ian\Documents\ArcGIS\GIS test data\output", "short_name")

If I simply run that script, I get the same error as I do with my script. What am I doing wrong?


I am using ArcGIS Pro 1.3.1, arcpy with python 3, and writing my script in pycharm IDE

2

As you can see at Terminology for distinguishing ArcPy installed with ArcGIS 10.x for Desktop from that which comes with ArcGIS Pro? there is a difference between the ArcPy functions available with ArcGIS Pro (Python 3.x) and ArcGIS 10.x for Desktop (Python 2.x).

It looks like you are trying to use the ArcGIS Pro tool named Split By Attributes in the ArcPy of either:

  • ArcGIS Pro where it exists and should work
  • ArcGIS 10.x for Desktop where it does not exist, and would not work

Various Q&As on this site have addressed how to implement this using the ArcPy of ArcGIS 10.x for Desktop, if that is what you are trying to do.

If you do not have ArcGIS 10.x for Desktop installed and are trying to do this using the ArcPy that is installed with ArcGIS Pro then you should revise your question to make that clear and include the version numbers of ArcGIS Pro and Python that you are using.

  • I am using arcgis pro 1.3.1. I have edited my original question to reflect this. – Ian Jorgeson Nov 25 '16 at 5:27

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.