How to select layer of .shp format by attribute using ArcPy?
I have to first load a vector layer (in .shp format) in arcmap and then it should select to specific attribute (the name of attribute is taken as input from user which i have done). and only selected attribute layer should be visible.
All this should be done using python.
So how can I do this? I have done this code snippet
import arcgisscripting import arcpy gp = arcgisscripting.create(9.3) gp.workspace = "E:oundary" sFile = "E:oundarysample.shp" lyr = "layer" gp.makefeatureLayer_management(sFile, lyr) gp.toolbox = "management" gp.SelectLayerByAttribute_management("layer", "NEW_SELECTION", " 'DNAME' = 'NAME' ") #now zoom to selected feature mxd = arcpy.mapping.MapDocument('CURRENT') df = arcpy.mapping.ListDataFrames(mxd, "Layers")  df.zoomToSelectedFeatures() arcpy.RefreshActiveView()
but it is throwing an error Runtime error Traceback (most recent call last): File "", line 7, in ExecuteError: ERROR 000732: Input Features: Dataset E:oundarysample.shp does not exist or is not supported.
In your code you have not specified the pathname to your shapefile correctly.
sFile = "E:oundarysample.shp"
sFile = r"E:oundarysample.shp"
This should make the 000732 error disappear.