Jan. 16, 2012
7:03 a.m.
Antoine Pitrou <pitrou@free.fr> added the comment:
However, the generated (files? and) dirs do not necessarily reflect the current situation as produced by os.listdir.
What do you mean exactly? Another process has re-created "b" in parallel? This race condition is pretty impossible to solve in the general case (unless the filesystem is transactional): even if you call os.listdir() again, a new file or dir could appear just before the following call to os.rmdir(). (just for the record, shutil.rmtree already allows you to delete a filesystem tree) ---------- nosy: +pitrou _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13779> _______________________________________