Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'exception:': 0.09; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'subject:access': 0.09; 'subprocess': 0.09; '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; 'runs.': 0.16; 'subject:subprocess': 0.16; 'cc:addr:python-list': 0.17; 'happening': 0.19; 'subject:Windows': 0.20; 'header:In-Reply- To:1': 0.21; 'appears': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; "what's": 0.23; 'handles': 0.26; '(in': 0.26; '(the': 0.28; 'raise': 0.28; 'problem': 0.28; 'cc:addr:python.org': 0.30; 'tjg': 0.30; 'tend': 0.32; 'file': 0.34; 'header:User-Agent:1': 0.35; 'quite': 0.36; 'running': 0.37; 'case': 0.37; 'another': 0.37; 'subject:: ': 0.38; 'received:192': 0.38; 'called': 0.39; 'under': 0.40; 'your': 0.60; 'closed': 0.62; 'virus': 0.63; 'our': 0.63; 'from:addr:mail': 0.65; 'to:none': 0.93; 'checker': 0.93 Date: Tue, 24 May 2011 14:09: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: File access denied after subprocess completion on Windows platform References: <201105241301.28431.claudiu@virtuamagic.com> In-Reply-To: <201105241301.28431.claudiu@virtuamagic.com> 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: 18 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306242549 news.xs4all.nl 49182 [::ffff:82.94.164.166]:60839 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6134 On 24/05/2011 11:01, Claudiu Nicolaie CISMARU wrote: > The problem appears when I close the called program (in our case > calc.exe). The (1) part (the call of os.rename) raise an exception: > > > (32, 'The process cannot access the file because it is being used by > another process') > [Error 32] The process cannot access the file because it is being used > by another process Try running procexp to see if it can see what's happening to the handle. It's possible it's a virus checker / indexer, although they'd tend to allow the file to be deleted out from under them. It's not quite clear from your description above whether you can be sure that the called subprocess has closed all its handles by the time the os.rename runs. TJG