Hi, I can't figure out why this won't run. Any of the methods below return ERROR 000732. I just created the geodatabase, and it's the latest version. ListFeatureClasses() will show the layer, but then arcpy.management.MakeFeatureLayer() fails.
There are some other geodatabases on my computer that will work, but I don't know why this one won't. I can export the feature class to a shapefile and then arcpy.management.MakeFeatureLayer will work on that.
#this is a geodatabase feature class. I can view it in ArcGIS, and within Arc I can run MakeFeatureLayer.
input_hydro = "F:\\scratch4\\test.gdb\\hydroTest"
arcpy.env.workspace = os.path.dirname(input_hydro)
ds = arcpy.ListFeatureClasses()
for d in ds:
print(d) #prints HydroTest
input_hydro_FL = arcpy.management.MakeFeatureLayer(in_features=input_hydro, out_layer="hydroOriginal")
input_hydro_FL = arcpy.management.MakeFeatureLayer(in_features=d, out_layer="hydroOriginal")
input_hydro_FL = arcpy.management.MakeFeatureLayer(in_features=os.path.basename(input_hydro, out_layer="hydroOriginal")
input_hydro_FL = arcpy.management.MakeFeatureLayer(in_features=input_hydro, out_layer="hydroOriginal")
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset hydroTest does not exist or is not supported
Failed to execute (MakeFeatureLayer).
don't you want the workspace set to the gdb? not the folder that it is in?
arcpy.env.workspace = "C:/data/base.gdb"not the c:/data folder as an example
os.path.dirname(input_hydro) returns the path to the GDB. When I set that as the workspace, it fails. When I give the full path to the in_features, it also fails. It works fine with some other geodatabases, and also works fine with shapefiles.