Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51585

Re: timing issue: shutil.rmtree and os.makedirs

References <fd605b09-ce7d-4c33-922d-57f423a09556@googlegroups.com> <mailman.5292.1375141959.3114.python-list@python.org> <ecb47a19-2763-4e2d-9e6e-1d9607b43cb0@googlegroups.com> <CAPTjJmr2Su2tkTryP6xds0sC0PWZA47dbOskU55hvThw7aRzCQ@mail.gmail.com>
Date 2013-07-30 20:09 +0300
Subject Re: timing issue: shutil.rmtree and os.makedirs
From Göktuğ Kayaalp <goktug.kayaalp@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5327.1375204161.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Jul 30, 2013 3:29 PM, "Chris Angelico" <rosuav@gmail.com> wrote:
>
> On Tue, Jul 30, 2013 at 2:10 PM, Tim <jtim.arnold@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

timing issue: shutil.rmtree and os.makedirs Tim <jtim.arnold@gmail.com> - 2013-07-29 12:16 -0700
  Re: timing issue: shutil.rmtree and os.makedirs Chris Angelico <rosuav@gmail.com> - 2013-07-30 00:52 +0100
    Re: timing issue: shutil.rmtree and os.makedirs Tim <jtim.arnold@gmail.com> - 2013-07-30 06:10 -0700
      Re: timing issue: shutil.rmtree and os.makedirs Chris Angelico <rosuav@gmail.com> - 2013-07-30 14:27 +0100
        Re: timing issue: shutil.rmtree and os.makedirs Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-30 14:07 +0000
          Re: timing issue: shutil.rmtree and os.makedirs Chris Angelico <rosuav@gmail.com> - 2013-07-30 15:47 +0100
        Re: timing issue: shutil.rmtree and os.makedirs Tim <jtim.arnold@gmail.com> - 2013-07-30 08:37 -0700
          Re: timing issue: shutil.rmtree and os.makedirs Chris Angelico <rosuav@gmail.com> - 2013-07-30 17:03 +0100
      Re: timing issue: shutil.rmtree and os.makedirs Göktuğ Kayaalp <goktug.kayaalp@gmail.com> - 2013-07-30 20:09 +0300

csiph-web