timing issue: shutil.rmtree and os.makedirs

Tim jtim.arnold at gmail.com
Tue Jul 30 11:37:22 EDT 2013


On Tuesday, July 30, 2013 9:27:10 AM UTC-4, Chris Angelico wrote:
> On Tue, Jul 30, 2013 at 2:10 PM, Tim 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:
> 
<<snip, thanks for the code and correction>>  
> ChrisA

Argg, this isn't the first time I've had troubles with the file system. This is FreeBSD and NFS. I will code up a progressive delay as you mentioned (with Steve's correction).

thanks much!
--Tim





More information about the Python-list mailing list