On Tue, Jul 30, 2013 at 2:10 PM, Tim <jtim.arn...@gmail.com> wrote: > hmm, now that you mention it, this is executing on a remote box with access > to the same file system my local calling program is on. That is, there is a > local call to an intermediate script that connects to a socket on the remote > where the above program actually runs, but the file system is the same place > for both local and remote. > > But even so, since the script that does the rmtree and mkdir is running on > the same machine (even though it's remote), I would think the mkdir couldn't > execute until the rmtree was completely finished.
Hmm. What system is used for the file system sharing? I know quite a few of them lie about whether something's been completely done or not. Can you use inotify to tell you when the directory's been deleted? Seems stupid though. Worst case, all you need is a quick loop at the bottom, eg: for delay in 100,300,600,1000,3000,5000,10000: if not os.path.exists(directory): break sleep(delay) That'll sleep a maximum of 20 seconds, tune as required. Of course, if there's a way to tune the FS to guarantee that the removal blocks correctly, that would be way better than sleep()! ChrisA -- http://mail.python.org/mailman/listinfo/python-list