On 12/05/2011 11:29, vijay swaminathan wrote:
<... snippet from code ...>
print 'Invoking Command Promptt..............'
#subprocess.call(["start", "/DC:\\PerfLocal_PAL",
"scripts_to_execute.bat"], shell=True)
subprocess.call(["start", "C:\\windows\\system32\\cmd.exe"],
shell = True)
self.status()
</snippet>
If you want to use start, use start /wait.
But you don't have to:
<code>
import threading
import time
import subprocess
def run_command (command):
#
# .call is shorthand for: start process and wait
# CREATE_NEW_CONSOLE prevents it from getting messed
# up with the Python console
#
subprocess.call (
[command],
creationflags=subprocess.CREATE_NEW_CONSOLE
)
t = threading.Thread (target=run_command, args=("cmd.exe",))
t.start ()
while t.is_alive ():
print "alive"
time.sleep (0.5)
print "Thread is dead"
</code>
TJG
--
http://mail.python.org/mailman/listinfo/python-list