Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Insert = arcpy.InsertCursor(polygons_shape)
ID= arcpy.da.SearchCursor(polygons_shape,'*')
for row in ID:
        if row[0]>1:
         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:

The Error:

myShape = row.getValue(shapeName)

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

share|improve this question


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)):  
del aRows  
share|improve this answer
yes, this was probably a problem with the combined use of two cursors together. But your code as it is presented would only duplicate the last row. I guess that you have more code but that you only show part of it. – radouxju Jul 16 '14 at 9:25

it would be easier to combine with arcpy.da.InsertCursor. Note that in your code the row[1] value is the shape field.

EDIT: as you found out, the main problem came from the use of 2 cursors together (and my first suggestion to use an edit session did not solve that).



ID= arcpy.da.SearchCursor(polygons_shape,fields)
for row in ID:
    if row[0]>1:
del ID

Insertc = arcpy.da.InsertCursor(polygons_shape, fields)
for newrow in list_rows:
    for i in range(newrow[0]):
del Insertc
share|improve this answer
@mahmoudhageer As indicated in this answer getValue/setValue are methods used with old style (arcpy) cursors and are not available with new style (arcpy.da). I too think you should standardize on using arcpy.da. – PolyGeo Jul 16 '14 at 7:46
It duplicate the rows in GDB, But still with Null Geometry for Polygons. – mahmoud hageer Jul 16 '14 at 8:28
strange. And are the other fields updated ? – radouxju Jul 16 '14 at 8:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.