AttributeError: 'list' object has no attribute 'setValue' ?

8835
3
01-28-2015 07:16 AM
JohannesBierer
Occasional Contributor III

Don't know how to get rid of that message?

input_shp = fc
arr = arcpy.Array()  
with arcpy.da.UpdateCursor(input_shp,['FID','SHAPE@']) as cur:  
  extents = []   
  for row in cur:  
    ext = row[1].extent  
    p0 = ext.lowerLeft; p1 = ext.upperRight  
    print('Extent of shape... {}: '.format(row[0]))  
    print(' X min/max  {}, {}'.format(ext.XMin,ext.XMax))
    Xmin = round((ext.XMin), 0)
    print (Xmin)
    row.setValue(fld_xmin, Xmin)
    print ( ' X min, {}'.format(ext.XMin))
    curs.updateRow(row)
    print(' Y min/max  {}, {}'.format(ext.YMin,ext.YMax))  
    arr.add(p0)  
    arr.add(p1)  
mp = arcpy.Multipoint(arr)  
print('Extent of all {}'.format(mp.extent)) 
0 Kudos
3 Replies
ChrisMowry
New Contributor II

I believe you need to change "row.setValue(fld_xmin,Xmin)" to row[1].setValue(fld_xmin,Xmin)

0 Kudos
DanPatterson_Retired
MVP Emeritus

I think you are having copy and paste issues

curs.updateRow(row)

where is curs defined?

I used cur in my response to your previous post  What means: TypeError: 'Row' object does not support indexing ??? which still isn't closed and builds upon my code

0 Kudos
JohannesBierer
Occasional Contributor III
0 Kudos