AnsweredAssumed Answered

InsertCursor will not work with the Set function

Question asked by LarryAdgate on Mar 16, 2018
Latest reply on Mar 16, 2018 by Dan_Patterson

#I would really appreciate some help on this: I need to use the Set function on this script to remove all
# my duplicates but the InsertCursor refuses to work here. Any Ideas, Thank You- Larry Adgate

 

 

import arcpy

fc1 = "Database Connections\\TaskmasterServer.sde\\sde_gsw.GSW_SDE.CCB_Updates1"
fc2= "Database Connections\\TaskmasterServer.sde\\sde_gsw.GSW_SDE.CCB_Data\\sde_gsw.GSW_SDE.Master_CCB_Points"
fc3 = "K:\\808 - TariffMaps\\MyResults\\MyTable.dbf"

set_one = set(r[0] for r in arcpy.da.SearchCursor(fc1,"PREM_ID"))
set_two = set(r[0] for r in arcpy.da.SearchCursor(fc2,"PREM_ID"))
print "Items unique to the Primary Field: {}".format(", ".join(sorted(set_one-set_two)))

results = set(set_one-set_two)
print results


cursor = arcpy.da.InsertCursor(fc3, ["result"])
#Below is my error= TypeError: value #0 - unsupported type: set
cursor.insertRow([results])

del cursor

Outcomes