Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:IDLE': 0.04; 'interpreter': 0.05; 'startup': 0.05; 'exists.': 0.07; 'advance': 0.07; 'any)': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; '(apologies': 0.16; 'helps.': 0.16; 'itself).': 0.16; 'received:74.125.82.46': 0.16; 'subject:under': 0.16; 'temp': 0.16; 'tempfile': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'usenet': 0.16; 'so.': 0.16; 'fix': 0.17; 'module': 0.19; 'fit': 0.20; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'file.': 0.24; "haven't": 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'too.': 0.31; 'anyone': 0.31; 'this.': 0.32; 'received:74.125.82': 0.34; 'connection': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'idle': 0.36; 'subject:?': 0.36; 'should': 0.36; 'list': 0.37; 'clear': 0.37; 'implement': 0.38; 'todo': 0.38; 'received:74.125': 0.39; 'delete': 0.39; 'tell': 0.60; 'hope': 0.61; 'skip:n 10': 0.64; 'within': 0.65; 'subject:tell': 0.84; 'washington': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=zJdwjznaBkfJ8yRWZsVYXd/egX5fLY8ApKCDVxy2chA=; b=PZPanOWAo+tTO5rOPblKNDOMh1erH/tQiTvdt+pX6H8LlZH2kyBMs0FpPEXXQHUKWb r8YZkPJOOBec299A773Jp84Qpx5++r1jBRF6JD7RN44acAY5ZZfmjgYr+5uUQ0JOROsj 1s8HHFqGXR/94z+P0bnJJkdYNudDzVABtm+oJe/PtXUCrSinNsEIldYYEz0oFMjVSvUA RPFxmcW4QQJmbNmRtF2fSz1ZmUkxiDRwG3aFJoDgiHR5domLyB+vwufHhWbhyoz3vp/y jVxD3+x76YNFXu413Lj0PK31Ll3ySVZytNF9Y0t9UNhMbIC2JxOcr9ABbte/77sVjvQt gT8g== MIME-Version: 1.0 X-Received: by 10.194.123.168 with SMTP id mb8mr23911905wjb.24.1365294932523; Sat, 06 Apr 2013 17:35:32 -0700 (PDT) In-Reply-To: <515e99c8$0$30001$c3e8da3$5496439d@news.astraweb.com> References: <515e99c8$0$30001$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 6 Apr 2013 17:35:32 -0700 Subject: Re: How do I tell if I'm running under IDLE? From: Mark Janssen To: "Steven D'Aprano" Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365294934 news.xs4all.nl 6905 [2001:888:2000:d::a6]:38965 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42957 > (Apologies in advance if you get multiple copies of this. My Usenet > connection seems to be having a conniption fit at the moment.) > > I'm looking for an official way to tell what interpreter (if any) is > running, or at least a not-too-horrible unofficial way. I was going to work on this IDLE TODO myself, but haven't got around to it. I think the best way is to use the tempfile module (to be clear this is a fix within IDLE itself). This is the whole procedure that should be necessary: 1) At IDLE startup check to see if there is an existing idle tempfile and delete it, if so. 2) Create an IDLE temp file. 3) At IDLE shutdown, delete prior tempfile. Now if anyone wants to see if IDLE is running, they only need to check to see if the tempfile exists. Hope that helps. If you implement it, you can take the item off the IDLE todo list too. MarkJ Tacoma, Washington