Message151370
| Author |
pitrou |
| Recipients |
docs@python, patrick.vrijlandt, pitrou, rosslagerwall, zbysz |
| Date |
2012年01月16日.15:03:21 |
| SpamBayes Score |
9.733171e-07 |
| Marked as misclassified |
No |
| Message-id |
<1326726202.79.0.567652085423.issue13779@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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) |
|