[GIS] Duplicating polygons in Layer using ArcPy cursors gives AttributeError: ‘tuple’ object has no attribute ‘getValue’

arcgis-10.1arcpyattributeerrorcursor

I am trying to Duplicate some polygons in the same layer with the same attributes, But it will duplicated them with Null Geometry, i have tried getValue() method, but i got error

import arcpy

polygons_shape="C:\\temp\\FinalLayers.gdb\\FinalLayers\\Polygons"
fields=['ID','Comment','owner']
Insert = arcpy.InsertCursor(polygons_shape)
ID= arcpy.da.SearchCursor(polygons_shape,'*')
for row in ID:
        if row[0]>1:
         dupCount=row[0]
         myShape = row.getValue(shapeName)
         insert_row.setValue('ID', row[0])
         insert_row.setValue('Comment', row[1])
         insert_row.setValue('owner', row[2])

         while dupCount>1:
                    Insert.insertRow(insert_row)
                    dupCount-=1

The Error:

myShape = row.getValue(shapeName)

AttributeError: 'tuple' object has no attribute 'getValue'

Best Answer

I have FOUND the ANSWER

infc = arcpy.GetParameterAsText(0)  
repnum = arcpy.GetParameterAsText(1)  

gRows = arcpy.da.SearchCursor(infc, "Shape@")  
for row in gRows:  
    origpoly = row  
del gRows  

aRows = arcpy.da.InsertCursor(infc, "Shape@")  

for x in xrange(0, int(repnum)):  
    aRows.insertRow(origpoly)  
del aRows  
Related Question