Python script is failing. It's supposed to make a selection from a lyer based on attributes value and then select intersecting features of that selection and then make a copy of the selection as a new featureclass. I'm getting the error messages at the end but nothing in between and I can't figure out why. I got it working and then added some documentation and then it began failing again. I've tried running it from PythonWin and as a script tool in ArcMap and ultimately prefer to run it in the latter.
# this script selects digitized streets as well as the streets # they intersect with from outdated centerline files and exports # to a new featureclass to be merged with up to date centerline file import arcpy arcpy.env.overwriteoutput = True try: # Enter parameters and run tool inPath = arcpy.GetParameterAsText(0) outPath = arcpy.GetParameterAsText(1) inPathFL = arcpy.MakeFeatureLayer_management(inPath, "inPathFL") arcpy.SelectLayerByAttribute_management(inPathFL, "NEW_SELECTION", ' "Link_ID" <= 10000') arcpy.AddMessage("selecting features with link ID less than 10,000") arcpy.SelectLayerBylocation_management(inPathFL, "INTERSECT", inPathFL, "10 Feet", "ADD_TO_SELECTION") arcpy.AddMessage("selecting layers by location that intersect with currently selected features") arcpy.CopyFeatures_management(inPathFL, outPathFL) arcpy.AddMessage("copying features") # report a success message arcpy.AddMessage("Created source streets feature class!") except: # get error messages arcpy.AddError("Could not complete the export for the intended selection") arcpy.AddMessage(arcpy.GetMessages()) print "Create source streets failed"
And here is the error message:
Executing: CreateSourceStreets CO_005_2012_Merge C:\RS_Data\Common\MapClips\CO_SF_2015Q2.gdb\CO_SF_2012_Source Start Time: Tue Dec 08 15:38:11 2015 Running script CreateSourceStreets... selecting features with link ID less than 10,000 Could not complete the export for the intended selection Executing: SelectLayerByAttribute inPathFL NEW_SELECTION " "Link_ID" <= 10000" Start Time: Tue Dec 08 15:38:11 2015 Succeeded at Tue Dec 08 15:38:11 2015 (Elapsed Time: 0.05 seconds) Completed script CreateSourceStreets... Failed to execute (CreateSourceStreets). Failed at Tue Dec 08 15:38:11 2015 (Elapsed Time: 0.76 seconds)