My script runs perfectly for feature classes, but not shapefiles. It crashes at the point of selection, provided there is a query.
gp.Workspace = "C:/someworkspace" fc = "featureclass.shp" query = "[SOME_TEXT_FIELD] = \"666\"" gp.MakeFeatureLayer(fc, "flyr") gp.SelectLayerByAttribute("flyr", "NEW_SELECTION", query)
ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).
Tested a similar simple example in the Python Shell. This runs fine with a geodatabase and feature class. I assume there is some sort of special treatment for shapefiles I'm not aware of, but arcgis desktop help does not specify anything.