Jason R. Coombs <jar...@jaraco.com> added the comment:

When I was working on a routine to checkout/patch/build/test/cleanup Python 
(see https://svn.jaraco.com/jaraco/python/jaraco.develop, and particularly 
scripts/test-windows-symlink-patch.py), I ran into a similar problem during the 
cleanup step. I tried using shutil.rmtree to clean up the folder that was 
checked out, but I repeatedly got 'access denied' exceptions.

I ended up working around the problem by using subprocess and cmd.exe's "rmdir 
/s /q".

I think this demonstrates three facets to this problem:

1) It doesn't just affect the test suite. It happens to other Python programs 
that are using shutil.rmtree (and possibly remove/unlink) to remove files that 
are in use.

2) It doesn't have to be that way. At the very least, there could (should?) be 
a function in Python that replicates 'rmdir /s /q', which is not subject to the 
'access denied' error.

3) We could use subprocess and cmd.exe to perform the unlink and rmtree 
operations in the test suite to bypass the transient failures until Python 
supports the behavior natively.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to