#______________________________________________________________________ #define a function that takes the the assets with duplicate locations and assigns primary, secondary and so on based on the sorting of three fields #function takes the pid value and the full list of culvert locations def setPrimLoc(pidV,CulvertLOC): upExp="\"PID\" = " + str(pidV) curUp = arcpy.UpdateCursor(CulvertLOC,upExp) arcpy.Sort_management(CulvertLOC, "CULVsort", [[ "RT_TYPE","ASCENDING"], ["RT_RAMP","ASCENDING"],["RID_ETE","ASCENDING"]]) pl=1 for row in curUp: row.PRIM_LOC = pl pl+=1 curUp.updateRow(row) # Delete cursor and row object del row del curUp #______________________________________________________________________ #build a list of the ID numbers with multiple locations #outer loop that cycles through the circulates through the list of duplicate values #sends them to the function that sets primary location curSch = arcpy.SearchCursor("CULVsort",MULTIPLEexpr) pidLIST=[] for row in curSch: if row.PID not in pidLIST: pidLIST.append(row.PID) print pidLIST del curSch val=0 for x in pidLIST: print "Start outer" pidV=pidLIST[val] print x sndLYR="LOC_LOAD_SGL_lyr" exprPID="\"PID\""+"="+str(x) arcpy.MakeFeatureLayer_management (CulvertLOC,sndLYR,exprPID) setPrimLoc(x,sndLYR) val+=1
exprPID="\"PID\""+"="+str(x) TypeError: 'unicode' object is not callable
Solved! Go to Solution.
pidLIST.append(row.PID) exprPID="\"PID\""+"="+str(x)
pidLIST.append(str(row.PID)) exprPID = "\"PID\" = " + x
pidLIST.append(row.PID) exprPID="\"PID\""+"="+str(x)
pidLIST.append(str(row.PID)) exprPID = "\"PID\" = " + x