Subprocess Problem (Wait and while)

Alban Nona python.koda at
Mon Aug 9 18:08:00 CEST 2010


I have some problem with my actual code.
In fact, the script is done to work within nuke from the foundry which is a
compositing software.
Homever, I have some code difficulties as I quite new in the area.

Here the deal:
Im using subprocess command to copy some files into local directory, like

    cmd = ['xcopy', '/E', '/I', '/Q', '/Y', '%s' % _folder.replace('/',
'\\'), '%s' % _temp.replace('/', '\\')]
    subprocess.Popen(cmd, shell=True)

Its copying quite well. I have no problem with that. But, after the copy I
would like to continue my code, but ONLY if the copy is done.
If Im using a WAIT, its freezing the main program (nuke) until the copy in
done. I want to avoid that. I also try "call" but same thing. Its
I though about something like:

while subprocess not finished:
   Do nothing
   Continue Program

Like this its checking if the files is copying and do nothing until its
done. I also tough:

while os.listdir(src) != os.listdir(dst):
 Do nothing
 Continue program

But Im not sure its quite good solution.
Someone can help me with this one please ?

Thank you ! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list