I am trying to split a feature layer by rows. I've previously some time ago been able to use the below script, however now when I use it, it returns:

Python ERROR 000840: The value is not a Feature Layer

import arcpy

outputNum = 5000000
outputFCName = "Flows" 

def listSplit(myList, n):
    for i in xrange(0, len(myList), n):
        yield myList[i:i + n]

arcpy.env.workspace = r"C:\...\Database.gdb" #The dots are replaced with a proper path
lyr = arcpy.mapping.Layer("Layername") 
arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
fList = list()

with arcpy.da.SearchCursor(lyr, "OID@") as cursor:
    for row in cursor:

listGroup = listSplit(fList, outputNum)

for x in listGroup:
    lyr.setSelectionSet("NEW", x)
    arcpy.CopyFeatures_management(lyr, arcpy.CreateUniqueName(outputFCName))

The reason for splitting is that I have a dataset with 24.000.000 rows, which I would prefer in smaller parts.

  • 2
    Try print type(lyr), what output? Try using MakeFeatureLayer
    – BERA
    Feb 28, 2020 at 11:00
  • What's the full error message including line number?
    – PolyGeo
    Mar 1, 2020 at 0:10

1 Answer 1


The culprit would be lyr = arcpy.mapping.Layer("Layername") which returns a Result object not a Layer.

You can try lyr = arcpy.mapping.Layer("Layername")[0] or MakeFeatureLayer as suggested.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.