I'm working on this script which creates a table within a geodatabase. It then grabs the unique values from a list and attempts to insert them into the table using an Insert Cursor.
I get the Error
Runtime error
Traceback (most recent call last):
File "<string>", line 25, in <module>
TypeError: sequence size must match size of the row
My code is as follows:
import arcpy
from arcpy import env
env.workspace = "C:\Users\USER\Desktop\BaseLayer\UniqueValue.gdb"
## Designate the input layer.
featureclass = "Q:\Admin\IP_AnnoTools\Intermediates\Intersects\Output_Hydro_Line_Intersect.shp"## Parameter
field = "FEATURE_TY"## Parameter
valueList = []
rows = arcpy.SearchCursor(featureclass)
for row in rows:
valueList.append(row.getValue(field))
uniqueSet = set(valueList)
uniqueList = list(uniqueSet)
uniqueList.sort()
arcpy.CreateTable_management("C:\Users\USER\Desktop\BaseLayer\UniqueValue.gdb", "unique")
arcpy.AddField_management("C:\Users\USER\Desktop\BaseLayer\UniqueValue.gdb\unique","UNIQUE_VAL","TEXT","","","100")
unique = "C:\Users\USER\Desktop\BaseLayer\UniqueValue.gdb\unique"
cursor = arcpy.da.InsertCursor(unique,("UNIQUE_VAL"))
for uv in uniqueList:
cursor.insertRow(uv)
del cursor
print uniqueList
del rows
del row
My output when I print my list is:
[u'FLOW-ARB-MANUAL', u'LAKE-REP-PRI', u'RIV-MAJ-REP-PRI', u'STR-INDEF', u'STR-PER', u'STR-RECUR']