grid files not deleting

Discussion created by mwbeckumn on Jun 23, 2011
Latest reply on Dec 19, 2011 by curtvprice

I've been using Python to batch process several thousand grid files.  My code is written to produce temporary files along the way, which are meant to be deleted after each loop iteration. 

Some of the temporary files get tied up in a process with PyScripter and therefore can't be deleted.  The files are left over '.adf' files (not sure what these are for) in the grid folders, and running a remove command produces the following error message.

>>> os.remove("C:/Projects/g2tmpc1/w001001.adf")

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'C:/Projects/GIS data/OBIA nearshore/DNR fish lakes/classifications/g2tmpc1/w001001.adf'

Attempting to delete the file in Windows explorer indicates that 'the action can't be completed because the file is open in PyScripter Python IDE'. 

Is there someway to kill python processes so I can delete these files?  Some web sleuthing revealed that the file can be opened and closed manually in Python before removal, but this fails to work.  Any help is greatly appreciated!