The script I am writing is simply to query multiple fields based on certain criteria and then assign a value to another field. I have multiple queries that need to be built. This is just the beginning as I am stepping into it slowly. This is literally the first script I've tried to write. I started working in Pro 2.4 which is where I am getting the TypeError. I tried it in ArcMap 10.5.1 and it ran fine. After researching a bit, I think it has something to do with changes between Python 2 and 3 but I am not sure. Field 0 is a short data type, Field 1 is a long data type and Field 2 is text.
If anyone has a suggestion on how to make it work in Pro, I would appreciate it.
fc = r"K:\PHYS\PROJECTS\LTSTest.gdb\Streets"
fields = ['LOCAL_SPEED_MPH', 'AADT_NBR', 'TestLTS']
with arcpy.da.UpdateCursor(fc,fields) as cursor:
for row in cursor:
if (row[0] <= 25 or row[1] <= 1500):
row[2] = 1
elif (row [0] > 40):
row[2] = 2
cursor.updateRow(row)
print("Done")
# Traceback (most recent call last):
# File "<string>", line 3, in <module>
# TypeError: '<=' not supported between instances of 'NoneType' and 'int'