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?

2 Answers 2


This is the relevant code to your error:

groundWaterFC = "KY_WaterWells_Springs"
arcpy.MakeFeatureLayer_management(groundWaterFC, "groundWaterFeatureLayer")

If you are inside ArcGIS Pro, and you have the KY_WaterWells_Springs in your map (thus in your Contents pane), and run this code from the Python window, it'll work great.

As you've presented the script, it appears you're running this code OUTSIDE ArcGIS Pro, probably from command line. In this case, you do not have a Contents pane, you do not have a layer loaded. You need to update the path of your groundWaterFC to point at the actual data set on disk, so the Make Feature Layer can find and load the featureclass, thus turning it into a "Layer". Since you already have: arcpy.env.workspace = r"C:\Users\benwj\OneDrive\Desktop\GEOG 485\Final_Project"

Assuming you have a file geodatabase in this directory, with your data, you could do something like this:

import os
arcpy.env.workspace = r"C:\Users\benwj\OneDrive\Desktop\GEOG 485\Final_Project"
#this is now a full path to your dataset
groundWaterFC = os.path.join(arcpy.env.workspace, "myGDB.gdb", "KY_WaterWells_Springs") 
arcpy.MakeFeatureLayer_management(groundWaterFC, "groundWaterFeatureLayer")
  • Even after updating the path to the actual dataset on disk, I get the same error. Could it be something to do with the dataset's geometry type? It is a feature class of point features. Commented Dec 7, 2022 at 12:44
  • No, the Make Feature Layer tool will take whatever the geometry is of the input feature class and simply make a layer. It doesn't care about the geometry type.
    – KHibma
    Commented Dec 7, 2022 at 14:00

I worked around the issue by converting the groundwater feature class to a shapefile, which then allowed me to make the feature layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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