Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51556
| References | <fd605b09-ce7d-4c33-922d-57f423a09556@googlegroups.com> <mailman.5292.1375141959.3114.python-list@python.org> <ecb47a19-2763-4e2d-9e6e-1d9607b43cb0@googlegroups.com> |
|---|---|
| Date | 2013-07-30 14:27 +0100 |
| Subject | Re: timing issue: shutil.rmtree and os.makedirs |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5306.1375190838.3114.python-list@python.org> (permalink) |
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. 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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