Hi Tim., Thanks.. This works as I had expected.
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? Any thoughts on this pls? On Thu, May 12, 2011 at 4:08 PM, Tim Golden <m...@timgolden.me.uk> wrote: > 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 > -- Vijay Swaminathan
-- http://mail.python.org/mailman/listinfo/python-list