arcpy.env.overwriteOutput = True env.workspce = "F:/GIS Data/Drivetesting.gdb" #mxd = arcpy.mapping.MapDocument("CURRENT") --used in the Arcpy environment #df = arcpy.mapping.ListDataFrames(mxd, "New Data Frame") --used in the Arcpy environment Field = "PCode1" FC = "F:/GIS Data/Drivetesting.gdb/Carrier/Phone" MyField = Myfield = arcpy.ListFields(FC)[24] arcpy.MakeFeatureLayer_management(FC,"FC_lyr") ---------> tons of geoprocessing going on right here, but not included as not relevant to question (and saves space!) mylist = [] # Iterate through the rows in the cursor for item in Scursor: a = (item.Frequency, item.PCode1,) mylist.append(a) mylist.sort() mylist.reverse() del mylist[1:] applist = [x[1] for x in mylist] applist.append(CellIDs.UNIQUE_ID) applist.append(CellIDs.CellID) print applist PCode1 = str(applist[0]) PCode2 = str(applist[1]) PCode3 = str(applist[2]) Unitname = str(applist[3]) Columnname = '"Cellname1"' print Cellname print MyField.name arcpy.SelectLayerByAttribute_management("FC_lyr","SUBSET_SELECTION",' "PN1" = ' + PCode1 + " or \"PN1\" = " + PCode2 + " or \"PN1\" = " + PCode3) arcpy.CalculateField_management("FC_lyr",Columnname,Unitname)
ERROR 000728: Field "Cellname1" does not exist within table Failed to execute (CalculateField).
Solved! Go to Solution.
Columnname= "Cellname1" Unitname = '"' + str(applist[3]) + '"'
Columnname= "Cellname1" Unitname = '"' + str(applist[3]) + '"'