File access denied after subprocess completion on Windows platform

Tim Golden mail at timgolden.me.uk
Tue May 24 09:09:02 EDT 2011


On 24/05/2011 11:01, Claudiu Nicolaie CISMARU wrote:
> The problem appears when I close the called program (in our case
> calc.exe). The (1) part (the call of os.rename) raise an exception:
>
> <type 'exceptions.WindowsError'>
> (32, 'The process cannot access the file because it is being used by
> another process')
> [Error 32] The process cannot access the file because it is being used
> by another process

Try running procexp to see if it can see what's happening to the
handle. It's possible it's a virus checker / indexer, although
they'd tend to allow the file to be deleted out from under them.
It's not quite clear from your description above whether you
can be sure that the called subprocess has closed all its handles
by the time the os.rename runs.

TJG



More information about the Python-list mailing list