Thanks again Richard. Python and programming in general are new to me, so I always appreciate the basic debugging tips.
I did some basic QC on my input feature classes and confirmed that there are no geometry errors.
The dictionary appears to be correct. It contains 335 items, which is the number I expect based on the input I used to create sticksRF_split. Here is a sample of what the dictionary output looks like:
u'J7MIJDJRDM': [(1368.551930715828, <Polyline object at 0x13beb890[0x13beb860]>)],
u'J7MIJLGT4M': [(1571.5487528800747, <Polyline object at 0x1346a510[0x1346a4e0]>)],
u'J7MIJDRLXQ': [(1347.2159353990594, <Polyline object at 0x13b53110[0x13b530e0]>)],
u'M5QMJ0CC2L': [(1313.688077024998, <Polyline object at 0x13bebf90[0x13bebf60]>)],
u'J7MIJ8HJZQ': [(1344.7776753085323, <Polyline object at 0x13beb650[0x13beb620]>)],
u'J7MIJ5QHMQ': [(1330.1471538449503, <Polyline object at 0x1346add0[0x1346ada0]>)],
u'K99ID3MOXV': [(1339.5960776588317, <Polyline object at 0x13471c70[0x13471c40]>)],
u'J7MIIT5TJQ': [(1344.1680296403613, <Polyline object at 0x2b989d0[0x2b98980]>)],
u'KA8ML48AOW': [(1385.925539247241, <Polyline object at 0x13471570[0x13471540]>)],
u'KA8MHNX69W': [(1461.8208431411147, <Polyline object at 0x1346a890[0x1346a860]>)],
u'J7MIJDCPVM': [(1151.2595366475489, <Polyline object at 0x134717b0[0x13471780]>)],
u'J7MIJKITUM': [(2126.2848170537795, <Polyline object at 0x1346ac10[0x1346abe0]>)],
u'L2OLSDE8NP': [(1409.090485039698, <Polyline object at 0x134714f0[0x134714c0]>)],
u'J7MIJB3R7Q': [(1368.551943220522, <Polyline object at 0x13beb850[0x13beb820]>)],
u'P69KSAA02B': [(1573.9873186602183, <Polyline object at 0x13466f30[0x13466f00]>)],
u'J7MIJASTCQ': [(1347.8256852251254, <Polyline object at 0x134664f0[0x134664c0]>)],
I checked a few of the dictionary items in ArcMap and confirmed that the first value in the dictionary is the length of the longest line associated with each key.
I took your advice @Anonymous User Fairhurst and tried some counts and prints. Since the dictionary looks good, I've been focusing on the update cursor, as shown below. I'm getting some odd results that I think are pointing me in the right direction. When I run the code below to the print statement line 3, I get a list of 1,011 PROPNUM values. If I run the entire block of code, I get 546 values from the print statement on line 3, and then I get the "IndexError: list index out of range" message.
with arcpy.da.UpdateCursor(targetFC, ["PROPNUM_GIS","SHAPE@"]) as uCur:
for count, row in enumerate(uCur, start=1):
print "This is the count of rows in the update cursor: " + str(count) + " - PROPNUM = " + row[0]
PROPNUM = row[0]
if PROPNUM in valueDict:
print "This is the count of PROPNUM in valueDict: " + str(count)
row[1] = valueDict[PROPNUM][1]
uCur.updateRow(row)
I think the problem I am having may be similar to one described on stackoverflow. In this case I am using a list of dictionary key values, and when I get to the end of the list, I get the error. Instead, I need to use an index. Am I on the right track here? The code below runs but neither modifies the feature geometry, nor gives messages in the Python interpreter.
try:
with arcpy.da.UpdateCursor(targetFC, ["PROPNUM_GIS","SHAPE@"]) as uCur:
for row in uCur:
PROPNUM = row[0]
if PROPNUM in range(len(valueDict)):
row[1] = [valueDict[PROPNUM] + valueDict[PROPNUM+1] for PROPNUM in range(len(valueDict)-1)]
print row[1]
uCur.updateRow(row)
except Exception as e:
arcpy.AddMessage(str(e.message))