First off, I am just learning Python, so if there is a more efficient way to do this, then I am all ears.... (NOTE: The code below is something that I was messing with to learn threads... So some functionality is not applicable for your needs..I just wanted to show you a demonstration) One way that you could get around this, is to use threads. You can lock your thread and when the lock has been released, you could open it and ensure your copy has succeeded. Just a thought.... ~~~~~~~~~~~~~~~~~~~~~~~ import thread def counter(myId, count): for i in range(count): stdoutmutex.acquire() #Copy Your File Here stdoutmutex.release() exitmutexes[myId].acquire()
stdoutmutex = thread.allocate_lock() exitmutexes = [] for i in range(2): exitmutexes.append(thread.allocate_lock()) thread.start_new(counter, (i, 2)) for mutex in exitmutexes: while not mutex.locked(): #Open Your File Here print 'Exiting' On 1/30/07, Hugo Ferreira <[EMAIL PROTECTED]> wrote:
Hi there, I have a problem. I'm using calling shutil.copyfile() followed by open(). The thing is that most of the times open() is called before the actual file is copied. I don't have this problem when doing a step-by-step debug, since I give enough time for the OS to copy the file, but at run-time, it throws an exception. Is there anyway to force a sync copy of the file (make python wait for the completion)? Thanks in advance! Hugo Ferreira -- http://mail.python.org/mailman/listinfo/python-list
-- http://mail.python.org/mailman/listinfo/python-list