Tool does not work from GUI, so I tested this script from help system:
SplitByAttributes example 2 (stand-alone Python script)
The following script demonstrates how to use the SplitByAttributes tool.
Name: SplitByAttributes.py
Description: Use the SplitByAttributes tool to split a feature class by unique values.
# Import required modules
import arcpy
# Set local variables
in_feature_class = 'c:/data/base.gdb/ecology'
target_workspace = 'c:/data/output.gdb'
fields = ['REGION', 'ECO_CODE']
arcpy.SplitByAttributes_analysis(in_feature_class, target_workspace, fields)
By creating:
With 2 relevant fields in ECOLOGY feature class:
Message:
Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\analysis.py", line 150, in SplitByAttributes raise e ExecuteError: 'unicode' object has no attribute 'polygon' Failed to execute (SplitByAttributes).
UPDATE:
One of the reasons original script fails is in this block:
arcpy.SelectLayerByLocation_management(lyr, 'INTERSECT',arcpy.env.extent.polygon)
when environment extent set to one of ["Union of inputs","Default","Intersection.."] env.extent does not have "polygon" property, thus the error message.
also I don't understand 3rd line
lyr = arcpy.MakeFeatureLayer_management(in_data, lyr_name)[0]
arcpy.SelectLayerByLocation_management(lyr, 'INTERSECT',
arcpy.env.extent.polygon)
in_data = lyr_name
So I copied script to custom toolbar, pointed it to copy of original script and changed 3rd line to
in_data = lyr
Script works now with explicit declaration of extent in environment. It also works with shapefiles.