Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:file': 0.07; 'errno': 0.09; 'ioerror': 0.09; 'open()': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'throw': 0.09; 'url:peps': 0.09; 'cases': 0.15; "'w'": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:windows': 0.16; 'wrote:': 0.17; 'url:dev': 0.17; 'thanks,': 0.18; 'permission': 0.20; 'file.': 0.20; 'trying': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'mode': 0.30; 'url:python': 0.32; 'file': 0.32; 'from:addr:yahoo.co.uk': 0.32; 'not.': 0.32; 'to:addr:python- list': 0.33; 'another': 0.33; 'open': 0.35; 'received:org': 0.36; 'url:org': 0.36; 'anything': 0.36; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'application': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'here': 0.65; 'distinguish': 0.84; 'received:2': 0.91; 'ali': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Detect file is locked - windows Date: Wed, 14 Nov 2012 01:14:59 +0000 References: <2af436e3-1336-42ae-aa2f-9e33135a3f2c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-197-9.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: <2af436e3-1336-42ae-aa2f-9e33135a3f2c@googlegroups.com> X-Antivirus: avast! (VPS 121113-1, 13/11/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352855611 news.xs4all.nl 6863 [2001:888:2000:d::a6]:46067 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33283 On 14/11/2012 00:33, Ali Akhavan wrote: > I am trying to open a file in 'w' mode open('file', 'wb'). open() will throw with IOError with errno 13 if the file is locked by another application or if user does not have permission to open/write to the file. > > How can I distinguish these two cases ? Namely, if some application has the file open or not. > > Thanks, > nomadali > Anything here help http://www.python.org/dev/peps/pep-3151/ ? -- Cheers. Mark Lawrence.