smoothed = arcpy.sa.FocalStatistics('input', neighborhood, "MEAN","NODATA") smoothed.save('output.tif')
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'E:/output.tif'
Solved! Go to Solution.
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:
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.
with arcpy.sa.FocalStatistics('input', neighborhood, "MEAN","NODATA") as smoothed: smoothed.save('output.tif')
Have you tried deleting your smoothed variable?
arcpy.Delete_management('output.tif')