Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

ArcPy delete terrain: cannot be deleted

$
0
0

I can’t get my ArcPy script to delete a terrain. If it exists, it should be deleted. However it throws an

ERROR 000317: {path} cannot be deleted

My script is a lot longer than this, but this is what it boils down to. fds is a feature dataset in a file geodatabase. The feature dataset contains a terrain with 2 associated feature classes:

  • a points feature class used as masspoints
  • a polygon feature class used as boundary/softclip

Here’s my code:

import os
import arcpy

fds = r'D:Dumfries & Borders.gdbDEM'

arcpy.env.workspace = fds
l = arcpy.ListDatasets()
for d in l:
    if arcpy.Exists(os.path.join(fds, d)):
        arcpy.Delete_management(os.path.join(fds, d))

Earlier on I tried to have the script delete the whole feature dataset at once. Didn’t work either. I then decided to delete the datasets in it one by one. The ListDatasets() lists only one: the terrain, which sparks the error mentioned above.

It is possible to delete the terrain or the feature dataset by hand in ArcCatalog, or using the Python window in ArcCatalog. However, even after closing all other programs (to preclude any locks from obstructing) except my Python interpreter (PyCharm) it still throws the same error.

So, any ideas?
Will post this to the ESRI forums as well.

edit follow-up:
removing the spaces and & from the gdb’s name does not help, as ListDatasets() won’t list anything now anymore. Also scriptwise trying to delete the feature dataset now throws an

ERROR 000732: Input Data Element: Dataset {path} does not exist or is
not supported.


Viewing all articles
Browse latest Browse all 767

Trending Articles