AnsweredAssumed Answered

Problem with python script: can only concatenate list (not "str") to list

Question asked by JB1234510 on Nov 8, 2017
Latest reply on Nov 8, 2017 by bixb0012

I've got a problem with the following script:

 

import arcpy, os

infile = r"C:\temp4\ALK_Merge.shp"
infileL = "infile_Layer"

count = int(arcpy.GetCount_management(infile).getOutput(0))

x = 99
xC = count/x

xC1 = xC + 2

for i in range(1, xC1):
    print i
   
    sPath = infile.split(".shp")
   
    print sPath
   
    xRange = i * 99
    xRange1 = (i*99)-99
    print xRange
    print xRange1

    outFeature = sPath + "_" + i + ".shp"

    arcpy.MakeFeatureLayer_management (infile, infileL)
    arcpy.SelectLayerByAttribute_management (infileL, "NEW_SELECTION", "\"FID\" <= " + xRange + "AND" + "\"FID\" >= "+ xRange1 + "")
    arcpy.CopyFeatures_management(infileL, outFeature)

The problem is in line 25:

outFeature = sPath + "_" + i + ".shp"
TypeError: can only concatenate list (not "str") to list

 

Any ideas how to solve this?

Outcomes