Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:# 20': 0.03; 'python': 0.07; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'prevents': 0.09; 'subprocess': 0.09; 'def': 0.13; 'wrote:': 0.14; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'shell=true)': 0.16; 'shorthand': 0.16; 'threading': 0.16; 'true)': 0.16; 'shell': 0.19; 'command': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'skip:" 30': 0.29; 'start,': 0.29; 'cc:addr:python.org': 0.31; 'skip:( 20': 0.31; 'tjg': 0.31; 'import': 0.32; 'received:192': 0.34; 'print': 0.35; 'header:User- Agent:1': 0.35; 'getting': 0.36; 'received:192.168': 0.37; 'but': 0.38; 'skip:" 20': 0.38; 'from:addr:mail': 0.60; 'subject:this': 0.79; 'messed': 0.84; 'to:none': 0.92 Date: Thu, 12 May 2011 11:38:02 +0100 From: Tim Golden User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 CC: python-list@python.org Subject: Re: Need Assistance on this program. References: <4DCBB18B.5050309@timgolden.me.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305196686 news.xs4all.nl 34849 [::ffff:82.94.164.166]:46217 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5225 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() If you want to use start, use start /wait. But you don't have to: 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" TJG