Я довольно новичок в Python, поэтому мне было интересно, может ли кто-нибудь рассказать мне, почему мой скрипт возвращает следующую ошибку. Да, я искал ошибку и ее смысл, но немного неясно, что это может вызвать ее. Заранее спасибо!Python script дает 'TypeError - Unsupported Type: Tuple'
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)
Я получаю следующее сообщение об ошибке:
Traceback (most recent call last): File "example.py", line 23, in cursor.updateRow(row) TypeError: value #0 - unsupported type: tuple
Failed to execute (SumFieldInsertNew).
Хорошо, спасибо, Trengot за это, я посмотрю, как я могу это исправить. – JumpInTheFire