On Jul 30, 2013 3:29 PM, "Chris Angelico" <ros...@gmail.com> wrote: > > 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.
Inotify is a linux thing, but there is kqueue for Free?BSD. OP can run the deletion procedure, wait for a NOTE_DELETE event, which would block, and create the fresh directory afterwards. It may require some C hacking though, in case Python lacks a kqueue wrapper. I think that this kind of approach would be more sound than a check-wait-loop approach. (I would elaborate more with pointers to appropriate documentation, but I'm on a silly tablet, please excuse me for that.) -gk
-- http://mail.python.org/mailman/listinfo/python-list