I am trying to delete a series of files from a gdb and I am encountering suprising difficulties doing so. When I test my procedure in one of the files, let's call it 'yy.shp'This is what I do:
from arcpy import env
from arcpy.sa import *
import os
env.workspace = env.scratchWorkspace = "path/to/my/GEODB.gdb"
arcpy.Delete_management(r'yy.shp')
And I receive the error:
Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\management.py", line 3995, in Delete raise e ExecuteError: ERROR 999998: Unexpected Error
Notice that if I do:
arcpy.Exists(r'yy.shp')
I get a TRUE
result
What am I doing wrong? I have checked and there is definitely no mistake in the path or names of the files. I got these names by dragging and dropping the gdb and file into the python console.
.gdb
directory contents with a shapefile set of files, you'll need to remove them from the directory (using the OS) before you can generate a legal name for deletion.