try finally doesn't

Colin Brown cbrown at metservice.com
Thu Nov 27 14:18:46 EST 2003


"Michael Hudson" <mwh at python.net> wrote in message
news:m3zneivwe3.fsf at pc150.maths.bris.ac.uk...
...
> Oh, if you're on Windows, things are likely to be different.
...

Sorry! Can't blame Bill for this one. It does the same thing for me under
RedHat Linux also ;-)

> What version of Python are you using?

Python 2.3.2

Colin

---------------------------------------------------------------
[cbrown at matahari cbrown]$ python2.3
Python 2.3.2 (#1, Oct  6 2003, 10:07:16)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[cbrown at matahari cbrown]$ cat tryfin.py
import thread, time, sys

def x():
    try:
        time.sleep(60)
    finally:
        print 'thread'
        sys.stdout.flush()
        sys.stderr.flush()

thread.start_new_thread(x,())
time.sleep(5)
[cbrown at matahari cbrown]$ python2.3 -u tryfin.py
[cbrown at matahari cbrown]$







More information about the Python-list mailing list