[GIS] Why is arcpy.da.SearchCursor code giving AttributeError: ‘int’ object has no attribute ‘split’

arcgis-10.2arcpy

I am new to python and am trying to get a string field in a geodatabase table to split and create a new row. Here is the code based on the solution from Splitting strings into new rows, retaining geometry:

import arcpy

inputTable="PathtoTable/XYZ.mdb/EasementsScratchSelectedRecords"
inputTableAgain="PathtoTable/XYZ.mdb/EasementsScratchSelectedRecords"

searchC =  arcpy.da.SearchCursor(inputTable, ("OBJECTID","DocumentNameorNumber","SecondaryIdentifier")) 

insertC = arcpy.da.InsertCursor(inputTableAgain, ("OBJECTID","DocumentNameorNumber","SecondaryIdentifier")) 

for row in searchC:
    A = [x.split('Point') for x in row[:-1] ]

    for i in range(min(len(A[0]),len(A[1]),len(A[2]))):
        newRow = [A[0][i] , A[1][i], A[2][i], row[3]]
        insertC.insertRow(newRow)
del insertC

I keep getting the following error:

line 17, in
A = [str(x.split('Point')) for x in row[:-1] ]
AttributeError: 'int' object has no attribute 'split'

Best Answer

In your code try replacing this:

for row in searchC:
    A = [x.split('Point') for x in row[:-1] ]

with this:

for row in searchC:
    print row[:-1]
    A = [x.split('Point') for x in row[:-1] ]

and I think you will see that row[:-1] is returning a list of integers that you are iterating and then cannot split individually.