TerrapinGeo

Python won't overwrite scratch rasters in loop - Arcpy - ArcGIS10.0

Discussion created by TerrapinGeo on May 29, 2013
Latest reply on Jun 1, 2013 by curtvprice
When attempting to delete or overwrite a scratch raster in a raster geodatabase, I keep getting errors along the lines of "Error:  000871 : Unable to delete the output"

I'm working on an iterated series of raster processes, which involves a lot of intermediate rasters for each iteration. I'm forced, for dumb engineering reasons, to use decimal seconds, so only saved rasters in a file geodatabase seem to work - IMGs and GRIDs and temporary grids cause errors in decimal seconds.

The problem I have is this. For some relatively long (geoprocessing wise) period of time after I've finished reading from or writing to a raster, the raster remains locked, and cannot be overwritten nor deleted. Currently, I'm working around this problem by writing each intermediate raster to a unique filename. This leaves me with a massive collection of unneeded intermediate files cluttering up my geodatabase.

I have tried just setting env.overwriteOutput = True, and just writing/overwriting a scratch filename each iteration, and I've tried using the arcpy.Delete_management() function at the end of each iteration, and still get the ERROR 000871.

Is there a way to force arcpy/Arc/python to release a file in the operating system, or is there something I'm leaving out that would cause them to be released? My google fu is failing me.

FWIW, running ArcGIS 10.0 (ArcInfo) with Spatial Analyst on Win7 64-bit.

Outcomes