I keep on getting an error on Select by location that the file cannot be found and the inputs are invalid, but I can't figure out what I'm doing incorrectly. I realize some of my variables unnecessarilly repeat themselves, which I plan to clean up, but it still doesn't explain why SelectByLocation isn't working.
# Import arcpy module
import arcpy
#Set Geoprocessing Environments
arcpy.env.overwriteOutput = True
arcpy.env.scratchWorkspace = "C:/PATH HERE/Testing"
arcpy.env.workspace = "C:/PATH HERE/ArcGIS/gdb.mdb"
# Parameters.
PRISM = arcpy.GetParameterAsText(0)
PRISM = "C:/LOCATION HERE"
#Unchanging Variables and Workspaces
Map = "C:/LOCATION HERE"
workspace = "C:/PATH HERE/gdb.mdb"
scratchWorkspace = "C:/PATH HERE/Testing"
PRISM_pts = scratchWorkspace + "/PRISM_pts.shp"
Pts_Lyr = scratchWorkspace + "/Pts_Lyr.lyr"
Map_Layer = scratchWorkspace + "/Map_Layer.lyr"
Prism_Lyr = scratchWorkspace + "/Prism_Lyr.lyr"
# Process: Raster to Point
arcpy.RasterToPoint_conversion(PRISM, PRISM_pts, "Value")
#Process: Make a Feature Layer for the Rasters
arcpy.MakeFeatureLayer_management(PRISM_pts, Pts_Lyr)
#Process: Make a Feature Layer for the Map
arcpy.MakeFeatureLayer_management(Map, Map_Layer)
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Map_Layer, "INTERSECT", Pts_Lyr, "", "")
#====================================
# Runtime error Traceback (most recent call last):
# File "<string>", line 1, in <module>
# File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py",
# line 6618, in SelectLayerByLocation
# raise e ExecuteError: Failed to execute. Parameters are not valid.
# ERROR 000368: Invalid input data.
# ERROR 000732: Selecting Features:
# Dataset C:/PATH HERE/Testing/Pts_Lyr.lyr
# does not exist or is not supported
# Failed to execute (SelectLayerByLocation).
#
# =====================================
# Process: Spatial Join
arcpy.SpatialJoin_analysis(Map, Prism_Lyr, Spatial_Join_shp, "JOIN_ONE_TO_ONE", "KEEP_ALL", "", "INTERSECT", "", "")
I don't quite understand why ArcGIS can't find the layer by location file, since it just created it. Am I missing a step?