Don't know if I'm up to date but I think you have to use make feature layer infront of your select by location. Out of the help files: import arcpy arcpy . env . workspace = "c:/data/mexico.gdb" # Make a layer and select cities which overlap the chihuahua polygon arcpy . MakeFeatureLayer_management ( 'cities' , 'cities_lyr' ) arcpy . SelectLayerByLocation_management ( 'cities_lyr' , 'intersect' , 'chihuahua' ) you should use: arcpy . env . workspace = r "C:\folder\Data.gdb" and not arcpy . env . workspace = r "C:\folder\Data.gdb\" r "C:\Data.gdb\%Name%_selection" will not work in python code, you will need to create a unique name for your output file.
... View more