Oct-12-2016, 03:32 AM
Howdy,
I am trying to get this script to create Grid Numbers for me in a mapping fishnet, but I am running into troubl with the error listed below - any suggestions ?
I am trying to get this script to create Grid Numbers for me in a mapping fishnet, but I am running into troubl with the error listed below - any suggestions ?
import arcpy arcpy.AddField_management("N:\GIS\Projects\Steve_Eastwood_Landuse\Plant_Biosecurity_Project\A0_Maps\Ao_template_Maps.gdb\Data\NTLLS_Fishnet" ,"REF","TEXT","","","5") rowCount = 0 with arcpy.da.UpdateCursor("N:\GIS\Projects\Steve_Eastwood_Landuse\Plant_Biosecurity_Project\A0_Maps\Ao_template_Maps.gdb\Data\NTLLS_Fishnet",["OID","REF"]) as cursor: for row in cursor: leftPart = (rowCount % 4) + 1 rightPart = ["A","B","C"][row[0] % 4] row[1] = str(leftPart)+str(rightPart) cursor.updateRow(row) if ((row[0]) % 64) == 63: rowCount = rowCount + 1
Error:Traceback (most recent call last):
File "C:\Users\hawkinle\Desktop\STDTAS\Fishnet2.py", line 8, in <module>
rightPart = ["A","B","C"][row[0] % 4]
IndexError: list index out of range
[Finished in 14.8s]
Thanks Leith