I have a very simple need: I want to delete a feature class from an ArcGIS Pro project permanently.
arcpy.Delete_management only seems to delete the layer from the map, but not the feature class. How can I delete the feature class permanently? (Apart from arcpy I could also use the ArcGIS Pro SDK, just in case somebody knows a way to do it there)
Thanks in advance
Solved! Go to Solution.
My guess is that you passed the layer name to Delete and that is why only the layer was deleted. If you want to delete a feature class, you need to pass the full path to the feature class to Delete so that it knows you are wanting a feature class and not a layer or some other object with the same name removed.
Thanks for your reply. I tried to specify the full path but I wasn't successful.. maybe I'm missing something. Here's the code I typed into the interactive python prompt in ArcGIS:
arcpy.CreateFeatureclass_management(arcpy.env.workspace, "test_fc", "POLYGON") <Result 'C:\\Users\\Tom\\Documents\\ArcGIS\\Projects\\Example\\Example.gdb\\test_fc'> arcpy.Delete_management('C:\\Users\\Tom\\Documents\\ArcGIS\\Projects\\Example\\Example.gdb\\test_fc') <Result 'true'>
However, the layer in the map is gone.. but the feature class is still present in the Example.gdb. What am I doing wrong?
*facepalm* You're right of course.. I assumed that the Catalog pane would update itself automatically just like everything else does in ArcGIS Pro to reflect changes. But turns out it didn't. Thanks a lot!