Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42958

Re: How do I tell if I'm running under IDLE?

Date 2013-04-06 20:43 -0400
From Dave Angel <davea@davea.name>
Subject Re: How do I tell if I'm running under IDLE?
References <515e99c8$0$30001$c3e8da3$5496439d@news.astraweb.com> <CAMjeLr-MwJbfP6bhyqeOJCOv3HL8fcv59VDTf3311e=9F5VCgw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.219.1365295417.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How do I tell if I'm running under IDLE? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-05 20:30 +1100
  Re: How do I tell if I'm running under IDLE? Dave Angel <davea@davea.name> - 2013-04-05 07:04 -0400
    Re: How do I tell if I'm running under IDLE? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-05 13:37 +0000
      Re: How do I tell if I'm running under IDLE? Tim Chase <python.list@tim.thechases.com> - 2013-04-05 09:33 -0500
  Re: How do I tell if I'm running under IDLE? Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-06 19:23 -0400
  Re: How do I tell if I'm running under IDLE? Mark Janssen <dreamingforward@gmail.com> - 2013-04-06 17:35 -0700
  Re: How do I tell if I'm running under IDLE? Dave Angel <davea@davea.name> - 2013-04-06 20:43 -0400

csiph-web