I am trying to select features by location, but am running into a problem where the input feature class is not being recognized.
# Import module
import arcpy
# Define workspace and overwrite status
arcpy.env.workspace = r"C:\Users\benwj\OneDrive\Desktop\GEOG 485\Final_Project"
arcpy.env.overwriteOutput = True
targetCounties = ['Harlan', 'Bell']
minesFC = "Ky_Permitted_Mine_Boundaries"
groundWaterFC = "KY_WaterWells_Springs"
createdShapefiles = []
for targetCounty in targetCounties:
countyQuery = "COUNTY_1 = '" + str(targetCounty.upper()) + "'"
countyLayer = arcpy.SelectLayerByAttribute_management(minesFC, "NEW_SELECTION", countyQuery)
arcpy.CopyFeatures_management(countyLayer, str(targetCounty) + "_Co_Mines")
createdShapefiles.append(str(targetCounty) + "_Co_Mines")
for createdShapefile in createdShapefiles:
arcpy.MakeFeatureLayer_management(groundWaterFC, "groundWaterFeatureLayer")
countyWaterLayer = arcpy.SelectLayerByLocation_management("groundWaterFeatureLayer", 'WITHIN_A_DISTANCE', createdShapefile, '800 Meters')
arcpy.CopyFeatures_management(countyWaterLayer, str(targetCounty) + "Co_Mine_Groundwater")
When I run the script, I get the error "ERROR 000732: Input Features: Dataset KY_WaterWells_Springs does not exist or is not supported Failed to execute (MakeFeatureLayer)."
The input feature class name is copied directly from ArcGIS Pro and it indeed exists. What could be causing this error?