Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

When i trying to do Select by location i got : arcgis scripting. ExecuteError: Failed to execute. Parameters are not valid. ERROR 000368: Invalid input data. Failed to execute (SelectLayerByLocation)

I am trying to excecute select by location on current selected feature after select by attribute.

env.workspace = "C:\temp"

input = 'C:\\temp\M0TASHT\M0TASHT.gdb\sLine'
input1= 'C:\\temp\M0TASHT\M0TASHT.gdb\sManhole'
arcpy.MakeFeatureLayer_management('sManhole', 'sManhole_lyr')
in_features = 'sManhole_lyr'
where_clause = '"ManholeSubtype" = ('"4515" ')'
arcpy.SelectLayerByAttribute_management(in_features, "NEW_SELECTION", where_clause)
arcpy.SelectLayerByLocation_management("C:\\temp\M0TASHT\M0TASHT.gdb\sLine", "INTERSECT", "sManhole_lyr", "", "NEW_SELECTION")
share|improve this question
Is your ManholeSubtype field Text or Integer? –  PolyGeo Mar 16 '14 at 12:44

1 Answer 1

up vote 6 down vote accepted

Instead of


you need to double all your back slashes to escape them i.e.


And instead of

where_clause = '"ManholeSubtype" = ('"4515" ')'


where_clause = ' "ManholeSubtype" = ' + " '4515' "


where_clause = ' ' ' "ManholeSubtype" = 4515 ' ' '

Which will depend on whether the field is text or integer.

share|improve this answer
I tried it, Not working –  mahmoud hageer Mar 16 '14 at 12:40
So why did you accept this answer? –  Ardit Sulce Oct 6 '14 at 18:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.