delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/02/20/08:14:44

X-Spam-Check-By: sourceware.org
Message-ID: <43F9C0B6.3070002@mit.edu>
Date: Mon, 20 Feb 2006 08:14:30 -0500
From: Steve Ward <ward AT mit DOT edu>
User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
MIME-Version: 1.0
To: Steve Ward <ward AT mit DOT edu>
CC: cygwin AT cygwin DOT com
Subject: Re: Python Tkinter after method silently exits (corrected)
References: <43F9B904 DOT 1050808 AT mit DOT edu> <43F9BEDE DOT 8070501 AT mit DOT edu>
In-Reply-To: <43F9BEDE.8070501@mit.edu>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

[Sorry for the spam; a paste bug omitted imports
  from the original program.  I've consolidated my
  previous 2 emails here; please ignore the earlier
  ones].

On upgrading to the latest 1.5.19-4 cygwin release, I
find that several previously working python programs
began mysteriously exiting.  I've boiled the problem
down to a skeletal test program (attached), which runs
under the prior 1.5.18-1 release but exits under 1.5.19-4.

The second thread seems necessary to stimulate the failure;
even commenting out the sleep(100) to make it return
immediately avoides the spurious exit.  When the second
thread is running, the self.root.after(...) call
apparently causes a silent exit rather than returning.

I'm using python 2.4.1 (the
current cygwin distribution) in both cases.  The test
program fails with a current, up-to-date cygwin setup;
downgrading ONLY cygwin1.dll to 1.5.18-1 causes it to
work, suggesting that the problem is with cygwin1.dll
rather than with python.

Any help/ideas would be appreciated...

- Steve Ward


# Demonstrate python/Tkinter threading bug

import sys, types, os, threading
import Tkinter as TK
from time import sleep

class App:

     def __init__(self, root):

         self.root = root
         self.update_loop()

         # Start a second thread, to do whatever...
         self.thread = threading.Thread(target=self.second_thread)
         self.thread.start()

     def update_loop(self):
         print >>sys.stderr, "*** update_loop"
         self.root.after(400, self.update_loop)

     def second_thread(self):
         sleep(100)

if __name__ == "__main__":
     root = TK.Tk()
     app = App(root)
     root.mainloop();

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019