AnsweredAssumed Answered

How do you close raster files in Arcpy created by .save()?

Question asked by alexjwebb on Feb 7, 2017
Latest reply on Feb 15, 2017 by alexjwebb

Hello. I have just starting using Arcpy on Python2.7 and I am saving raster datasets as tiff files using .save() on raster objects as explained here (  I am saving enough that I am encountering memory issues half way through my code, causing it to crash.  I believe python is not closing these files after it saves them.  I can use psutil to view the files which are currently opened by python and I see that they are all still open, and windows also tells me they are still 'open in pythonw' if I try to delete them.  I have tried assigning the command itself to a variable and deleting this, but it does not close the file (even after an explicit garbage collection call), nor does it close the file if you delete the raster variable itself.


How do you close a raster which has been created/opened by the .save() command without closing python?