4

I am using ArcGIS Desktop 10.5.

I have had this work for me before, so I am confused as to what problem I am -running into now. When making a selection to copy to a new dataset in Arcpy, -here is the important part of the code:

sortoutput = 'c:/Users/srcha/Desktop/Cluster_Analysis/output/Ld_Playas_extracted1_sorted.shp'
sortedftr = 'C:/Users/srcha/Desktop/Cluster_Analysis/output/Ld_Play_extra_sort_ftr.shp'
arcpy.MakeFeatureLayer_management(sortoutput,sortedftr)
arcpy.SelectLayerByAttribute_management(sortedftr, selection_type="NEW_SELECTION", where_clause='"AREA_ADJ" >=0.07957')

This yields the following error:

ExecuteError: Failed to execute. Parameters are not valid. Error 000732: Layer Name of Table View: data set C:/Users/srcha/Desktop/Cluster_Analysis/output/Ld_Play_extra_sort_ftr.shp does not exist or is not supported

Failed to execute (SelectLayerByAttribute)

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jan 24, 2018 at 17:46

1 Answer 1

6

You cant create a feature layer on disk, it is stored in memory only.

Change:

sortedftr = 'C:/Users/srcha/Desktop/Cluster_Analysis/output/Ld_Play_extra_sort_ftr.shp'

To:

sortedftr = 'sortedftr_lyr'

After the selection if you can use Copy features to convert the layer to a shapefile on disk.

You dont actually need Select by attributes, this can be done with the where_clause of Make Feature Layer:

where_clause (Optional)

An SQL expression used to select a subset of features.

answered Jan 24, 2018 at 17:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.