AnsweredAssumed Answered

Python script giving 'TypeError - Unsupported Type: Tuple'

Question asked by lancemwilson on Aug 13, 2014
Latest reply on Aug 13, 2014 by lancemwilson

Hello all - I'm pretty new to Python so I was wondering if anyone could please tell me why my script is returning the following error. Yes, I have looked up the error and its meaning, but am a little unclear on what could be causing it. Thank you in advance!

 

import arcpy

# Define the feature class
fc = r'C:\path\to\your\fc'

# find the unique 'SEGMENT_LENGTH' values
Slist = list()
for row in arcpy.da.SearchCursor(fc, 'SEGMENT_LENGTH'):
    # if the value isn't in the list then add it to the list
    if not row[0] in Slist:
        Slist.append(row[0])

for Value in Slist:
    # definition query to limit the rows in the cursor
    DefQ = 'SEGMENT_LENGTH = ' + str(Value)

    # Use a generator expression to populate a list from the 'QUANTITY_SOLID' field
    b = sum(row[0] for row in arcpy.da.SearchCursor(fc, 'QUANTITY_SOLID')),DefQ

    with arcpy.da.UpdateCursor(fc, ['QUANTITY_SOLID_SUM'],DefQ) as cursor:
        for row in cursor:
            row[0] = b
            cursor.updateRow(row)

 

I receive the following error:

 

Traceback (most recent call last):   File "example.py", line 23, in
<module>
cursor.updateRow(row) TypeError: value #0 - unsupported type: tuple
Failed to execute (SumFieldInsertNew).

Outcomes