AnsweredAssumed Answered

raster created by arcpy.sa.FocalStatistics cannot be deleted

Question asked by peter.kennedy on Jul 23, 2013
Latest reply on Jul 23, 2013 by peter.kennedy
I've successfully created a raster using FocalStatisitics:
  smoothed = arcpy.sa.FocalStatistics('input', neighborhood, "MEAN","NODATA")   smoothed.save('output.tif')


Problem:
The problem is that when I try to delete the 'output.tif' file within Python, I get the following error:

WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'E:/output.tif'


The problem also occurs in an interactive Python session - the file cannot be deleted by Windows Explorer until the PythonWin is closed.  I assume the problem is that FocalStatistics did not close the file it created.

How can I delete 'output.tif' within Python?  I am new to arcpy so I may be missing something obvious.

Outcomes