I have a Python test suite that creates and deletes many temporary files. On Windows 7, shutil.rmtree operations (<1% of the time) are sometimes performed. The failure is apparently random, not always in the same files, and not always the same, but it always works in rmtree operations. It seems to be a matter of time. He also recalls that Windows 7 increases vigilance with respect to access rights and administrator rights, but there are no rights (since the code just created the files) and there are no administrator rights in the mix.
It also looks like a synchronization problem between two threads or processes, but there is also no concurrency here.
Two examples of (partial) stack traces:
File "C:\ned\coverage\trunk\test\test_farm.py", line 298, in clean shutil.rmtree(cleandir) File "c:\python23\lib\shutil.py", line 142, in rmtree raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg) WindowsError: [Errno 5] Access is denied removing xml_1 File "C:\ned\coverage\trunk\test\test_farm.py", line 298, in clean shutil.rmtree(cleandir) File "c:\python23\lib\shutil.py", line 142, in rmtree raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg) WindowsError: [Errno 3] The system cannot find the path specified removing out
In Windows XP, it never worked. On Windows 7, it fails like this in several different versions of Python (2.3-2.6, not sure about 3.1).
Has anyone seen anything like this and had a solution? The code itself is on bitbucket for a really hardworking one.
source share