Subprocess Problem (Wait and while)
Alban Nona
python.koda at gmail.com
Mon Aug 9 12:08:00 EDT 2010
Hi,
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
this:
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
freezing...
I though about something like:
while subprocess not finished:
Do nothing
else:
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
Else:
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: <http://mail.python.org/pipermail/python-list/attachments/20100809/b6e2f2c2/attachment.html>
More information about the Python-list
mailing list