AnsweredAssumed Answered

UpdateCursor not updating attributes

Question asked by hcopropappr on Oct 13, 2014
Latest reply on Oct 13, 2014 by jskinner-esristaff

I'm using ArcCafe's shiftfeature example and it is working great for shifting the shape.  However I want to add an update to one of the attributes and that is not working.  Here is my code.  The script runs fine and acts like it's working but when I go into the attribute table after running it non of my keynumbers show up...all are still null.  What am I doing wrong?

 

def shift_features(in_features,  keynumber, x_shift=None, y_shift=None):

    ikeynumber = int(keynumber)

    with arcpy.da.UpdateCursor(in_features, ['SHAPE@XY','KEYNUMBER']) as cursor:

        for row in cursor:

             cursor.updateRow([[row[0][0] + (x_shift or 0),

                               row[0][1] + (y_shift or 0)], ikeynumber])

    return

Outcomes