Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Script works in python win but does not in al toolbox within ArcMAP

$
0
0
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

Attachment 31617
Attached Thumbnails
Click image for larger version

Name:	result with script.jpg‎
Views:	N/A
Size:	394.1 KB
ID:	31617  

Viewing all articles
Browse latest Browse all 2485

Trending Articles