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


Groups > comp.lang.python > #36880

Re: atexit handler in IDLE?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'handler': 0.04; 'subject:IDLE': 0.04; 'see:': 0.07; 'called.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'def': 0.10; '"this': 0.13; 'steve': 0.13; 'atexit': 0.16; 'program"': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'import': 0.21; 'command': 0.24; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'strings,': 0.29; 'print': 0.32; 'idle': 0.33; 'to:addr:python-list': 0.33; 'same.': 0.35; 'subject:?': 0.35; 'received:org': 0.36; 'but': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; '7:25': 0.84; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: atexit handler in IDLE?
Date Tue, 15 Jan 2013 20:27:22 -0500
References <24E53D14-FD57-4FE2-8763-99149773650B@spvi.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <24E53D14-FD57-4FE2-8763-99149773650B@spvi.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.559.1358299670.2939.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358299670 news.xs4all.nl 6901 [2001:888:2000:d::a6]:60901
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36880

Show key headers only | View raw


On 1/15/2013 7:25 AM, Steve Spicklemire wrote:

> import atexit
> print "This is my program"
>
> def exit_func():
>      print "OK.. that's all folks!"
>
> atexit.register(exit_func)
> print "Program is ending..."

If you put () around the strings, it will run the same *and* work in 3.x.

> When I run this on the command line I see:
>
> This is my program
> Program is ending...
> OK.. that's all folks!
>
> When I run this in IDLE I see:
>
> This is my program
> Program is ending...
>
> But the atexit handler is never called. ;-(

I tried in 3.3 idle and get the same.

-- 
Terry Jan Reedy

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


Thread

Re: atexit handler in IDLE? Terry Reedy <tjreedy@udel.edu> - 2013-01-15 20:27 -0500

csiph-web