jiefanyu

Why the result from Copy Feature did not show up?

Discussion created by jiefanyu on Sep 2, 2011
I have a code running successfully. But the result from copyfeature cannot find in my mdb except for once.
Anyone know this is why?
Codes:

# ExtactFeaturesByLocationAndAttribute.py
# Description: Extract features to a new feature class based on a Location and an attribute query
# Requirements: Python and the Python win32all extension
# Author: ESRI
# Data 1/1/2004

# Create the Geoprocessor
import arcgisscripting
gp = arcgisscripting.create()

# Put in error trapping in case an error occurs when running tool
try:
    # Make a layer from the feature class
    gp.MakeFeatureLayer("C:/temps/pro.mdb/Counties", "Counties_lyr")
    gp.MakeFeatureLayer("C:/temps/pro.mdb/Roads", "Roads_lyr")

    #Select all polygon that overlap the lines
    gp.SelectLayerByLocation("Counties_lyr", "intersect", "Roads_lyr")

    # Within the selection (done above) further select only those attributes satisfy some requirement
    gp.SelectLayerByAttribute("Counties_lyr", "[area] > 13862709075", "SUBSET_SELECTION")

    # Write the selected features to a new feature class
    gp.CopyFeatures("Counties_lyr", "C:/temps/pro.mdb/")

except:
    # If an error occurred, print the message to the screen
    print gp.GetMessages()

Outcomes