Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!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; 'assuming': 0.09; 'pretend': 0.09; 'run,': 0.09; 'subject:How': 0.10; 'python': 0.11; '(apologies': 0.16; 'helps.': 0.16; 'itself).': 0.16; 'janssen': 0.16; 'subject:under': 0.16; 'temp': 0.16; 'tempfile': 0.16; 'usenet': 0.16; 'so.': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'module': 0.19; 'fit': 0.20; 'seems': 0.21; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'file.': 0.24; "haven't": 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'too.': 0.31; 'anyone': 0.31; 'this.': 0.32; 'running': 0.33; 'connection': 0.35; 'but': 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; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'delete': 0.39; 'to:addr:python.org': 0.39; 'tell': 0.60; 'hope': 0.61; 'skip:n 10': 0.64; 'within': 0.65; 'received:74.208': 0.68; 'received:74.208.4.194': 0.84; 'subject:tell': 0.84 Date: Sat, 06 Apr 2013 20:43:09 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: python-list@python.org Subject: Re: How do I tell if I'm running under IDLE? References: <515e99c8$0$30001$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Vef0GZ5RD+BmnGod2LahaRiyROkCcUoKUo5arAUrY9c LAfY1Kq8iuqeBWAtepkw0hpPIraMxJjBasobP6qa12/rsPjziU CPnu1r3pcmVogDSmPiCvxbwLpVt+qO92HUfdv260rh0kx6c4A9 4AweiYZTbp6TbDkwyqN7hEGX6n3Af1RDnzrdjFbA2T0+FlgIHh NyY3aGVIhKJfMlkNPee8fRRn3+HJGuydj1nyautWYqWydXQ4YF qJ8rPJ+SJA4NKHlYbQbXXdIoHZh+xmYEvQKp9bQvis2XcJIu2s f55c/H+A22AMAKclJRdmjlUTBNPD+VAVwMrx8nuN0baSEV67g= = 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365295417 news.xs4all.nl 6912 [2001:888:2000:d::a6]:41777 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42958 On 04/06/2013 08:35 PM, Mark Janssen wrote: >> (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. > Are you assuming then that there can be only one instance of IDLE ? And that if a separate Python program is run, we should pretend that it's running under IDLE? -- DaveA