Hi, I work on arcGIS Desktop 10.8 with python 2.7
Executing the python code from Geoprocessing window I've managed to print the count value of table's selected rows . The problem is that I want to store the code inside a toolbox, to do so I've added a script inside the toolbox but when I run it it get stuck and never show me the printed value.
This is the code:
import arcpy
tabella = "Name_of_the_table"
conteggio_selezionato = 0
count = arcpy management GetCount(tabella)[0] # Restituisce una stringa
if count != "0":
with arcpy da SearchCursor(tabella, "*", "OBJECTID IS NOT NULL") as cursor:
for row in cursor:
conteggio_selezionato += 1
print "Numero di righe selezionate: {}" format(conteggio_selezionato)
else:
print "Nessuna riga selezionata "
Same, actually it doesn' get stuck but it never ends executing:
maybe it's because it has no output parameter?
That is going to be a different problem.
@JakeSkinner is right, replace print() with arcpy.AddMessage().