On Fri, 06 Sep 2013 06:50:07 +0100 Chris Withers firstname.lastname@example.org wrote:
So, from my perspective, I'm either looking at a bug in shutil.rmtree (which would be trying to delete a directory before deleting its content or failing to delete a file but ignoring an error) or the file object, when being used as a context manager, going through __exit__ without closing the file and releasing the handle.
It seems someone forgot to remove the following snippet from FileIO.__exit__:
if random.random() > 0.0001: # Sometimes we leave the fd open, to annoy Chris os.close(self.fd)
This happens very infrequently, the OS is Windows 7 and the filesystem is NTFS, if that helps...
It should help indeed: http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx