Hi Tim.,<br><br>Thanks.. This works as I had expected. <br><br>are there any documentation for the subprocess.call method? I tried going through the python doc but could not narrow down. I just wanted to know how do I pass an arguement after invoking the command prompt? <br>
<br>Any thoughts on this pls?<br><br><br><div class="gmail_quote">On Thu, May 12, 2011 at 4:08 PM, Tim Golden <span dir="ltr"><<a href="mailto:mail@timgolden.me.uk">mail@timgolden.me.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On 12/05/2011 11:29, vijay swaminathan wrote:<br>
<br>
<... snippet from code ...><br>
print 'Invoking Command Promptt..............'<br>
#subprocess.call(["start", "/DC:\\PerfLocal_PAL", "scripts_to_execute.bat"], shell=True)<br>
subprocess.call(["start", "C:\\windows\\system32\\cmd.exe"], shell = True)<br>
self.status()<br>
</snippet><br>
<br>
If you want to use start, use start /wait.<br>
<br>
But you don't have to:<br>
<br>
<code><br>
import threading<br>
import time<br>
import subprocess<br>
<br>
def run_command (command):<br>
#<br>
# .call is shorthand for: start process and wait<br>
# CREATE_NEW_CONSOLE prevents it from getting messed<br>
# up with the Python console<br>
#<br>
subprocess.call (<br>
[command],<br>
creationflags=subprocess.CREATE_NEW_CONSOLE<br>
)<br>
<br>
t = threading.Thread (target=run_command, args=("cmd.exe",))<br>
t.start ()<br>
<br>
while t.is_alive ():<br>
print "alive"<br>
time.sleep (0.5)<br>
<br>
print "Thread is dead"<br>
<br>
</code><div><div></div><div class="h5"><br>
<br>
TJG<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Vijay Swaminathan<br>