AnsweredAssumed Answered

get feature extent error

Question asked by melodykee on Aug 3, 2011
Latest reply on Aug 4, 2011 by melodykee
I was trying to follow an python script example of getting extent of features (Note "test.shp" is polygon feature)

________________________________________________________
import arcpy
from arcpy import env

env.workspace = "C:/Data/"

sCur = arcpy.SearchCursor("test.shp", "","","ID_1" )

# Fetch each feature from the cursor and examine the extent properties
#
for row in sCur:
    geom = row.shape
    ext = geom.extent  # or row.Shape.extent
    print "Extent of feature:\nXMin: %f, YMin: %f, \nXMax: %f, YMax: %f" % \
             (ext.XMin,ext.YMin,ext.XMax,ext.YMax)
_________________________________________________________________

The script stopped at "ext = geom.extent". The error message shows:
    ext = geom.extent
AttributeError: 'passthrough' object has no attribute 'extent'

I don't know how to fix it. Any idea? Thanks!

Outcomes