AnsweredAssumed Answered

what should be a basic script

Question asked by jpage43 on Aug 29, 2012
Latest reply on Sep 6, 2012 by jpage43
Thanks in advance for any suggestions!

I'm attempting to write what should be a fairly basic script and could use some advice. It's been a while since I've done this (v9.1) and things have changed a bit since then.

Basically I want to do the following:
Select a specific polygon within a feature class
Select by location points within that polygon
Export a table of attribute information from the points that is named based on an attribute field in the selected polygon

But, in my earlier scripting (v9.1) I was using the OID field of a .shp to name output files, which is a valid property of the describe function. Now that I want to use a different field it's giving me an error.

I'm wondering if someone could help point me in the right direction for a function that will allow me to get a specific attribute field and then name an output file based on the text in that field? The beginning of my script is below, and the error says the field I'm interested in does not exist even though it does.

---------
# Import arcpy module
import arcpy

# Local variables:
Watershed_Polygons = ".\\Testing\Script\\DataInputData.gdb\\Watershed_Polygons"
Output_mdb = ".\\Testing\Script\\Output.mdb"
OutputTables_mdb = ".\\Testing\Script\\Output.mdb"
Output_Layer = "Points_Layer"
Points  = ".\\Testing\Script\\DataInputData.gdb\\Points"
Output_Table = ".\\Testing\Script\\Output.mdb\\Output_Table"


print "Start"

# Get the Watershed Field for the Polygons
WATERSHEDField = arcpy.Describe (Watershed_Polygons).WATERSHEDFieldName

## THIS IS WHERE IT STOPS
WATERSHEDField = arcpy.Describe(Watershed_Polygons).WATERSHEDFieldName
RuntimeError: DescribeData: Method WATERSHEDFieldName does not exist

print "Get watershed field"

#Set an update cursor on the rows of the Watershed Polygons
rows = arcpy.UpdateCursor(Watershed_Polygons)
row = rows.Next()

#Loop through each polygon and perform the following processes on each individual watershed polygon
while row:

    #insert processes here

Outcomes