I am reading images (through Python) and do something. These images are placed in a temporary file, through:
tf = tempfile.mkdtemp(filename)
I use gdal to read the images (short part of code):
... tif_image = gdal.Open(str(out_ROI)) x = tif_image.RasterXSize y = tif_image.RasterYSize geo = tif_image.GetGeoTransform() band = tif_image.GetRasterBand(1) Values = band.ReadAsArray(0,0,x,y) ...
In the end I want to delete the folder created with mkdtemp, through:
import shutil shutil.rmtree(tf)
Before that I close the images just as I read in this posts:
band = None Values = None tif_image = None
But I always get the error:
WindowsError: [Error 32] The process cannot access the file because it is being used by another process
What I am missing?