Original User: af.ramirez
Hi everybody...
I've been developing a quite long script, and I tested it in PyScripter an IDLE when it was finished.... well it works perfectly, so I added it to a toolbox in ArcMAP and when I ran it it did not work....
I have spent many days trying to figure out what the problem is but until now it has been imposible...
This is a piece of the code where the error comes out...
print "Startin iterations"
    print datetime.datetime.now()
    fields= ("FID", "avg_mindis", "I_conc", "Max_lenght","TamanoTerr")
    ##create UpdateCursor and iterate trough each register
    with arcpy.da.UpdateCursor(territory,  fields) as cursor:
        for row in cursor:
            currentID= row[0]
            #print currentID
            ## select current cell with current FID
            where= " FID = " + str(currentID)
            arcpy.SelectLayerByAttribute_management(territory_lyr, "NEW_SELECTION", where )
            arcpy.SelectLayerByLocation_management(eventos_lyr, "INTERSECT", territory_lyr, "" , "NEW_SELECTION") 
I don't know if maybe there is a problem with the selection by attributes...
Appreciate any help..
Felipe Ramirez
GIS Analyst
[ATTACH=CONFIG]31617[/ATTACH]