AnsweredAssumed Answered

UpdateCursor: "TypeError: sequence size must match size of the row" ??

Question asked by adailey_slo on Jun 8, 2020
Latest reply on Jun 8, 2020 by bixb0012

I'm just learning about Cursors and am trying out the UpdateCursor with fake data in a feature class in a file geodatabase.  I am working towards editing values in existing rows.  I have been able to successfully do this to an extent:  I'm using a counter to give each row a unique value, starting at 1.  The data type is text/string (because this field is for building number, so it could include a building number such as H-101 or something).  


When the counter hits double-digits, i.e. 10, it throws a Type Error - "sequence size must match size of the row."  I read about this error on this Esri page: Error: TypeError: sequence size must match size of the row  

But nothing there seemed to apply to my code.  Does arcpy think that a double-digit number has two pieces, so it cannot be put into one cell??  


Here is my code:


import arcpy
fc = "H:\ActiveShooter\ActiveShooterAutomation\ActiveShooterAutomation.gdb\Fake_AS_buildings"

# This worked only up to 9, assigning building numbers from 1 to 9.  Error after 9:
# "TypeError: sequence size must match size of the row" ???
counter = 0
with arcpy.da.UpdateCursor(fc, ["BUILDING_NUMBER"]) as cursor:
    for row in cursor:
        counter += 1
        row = str(counter)
        print(row, type(row))  # For testing/diagnostic purposes


Here is what happened in ArcMap.  The cell values were successfully edited/entered, up through 9.



Can anybody help me figure out why this error is occurring?  Thank you!!