Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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; 'python.': 0.02; 'python,': 0.02; '(so': 0.07; '64-bit': 0.07; 'tkinter': 0.07; 'api': 0.09; 'python': 0.09; '22,': 0.09; 'imports': 0.09; 'cc:addr:python- list': 0.10; 'gui': 0.11; 'thread': 0.11; 'library': 0.15; '(but': 0.15; 'cocoa,': 0.16; 'deadlock': 0.16; 'invocations': 0.16; 'later).': 0.16; 'subject:import': 0.16; 'thread.': 0.16; 'vpython': 0.16; 'wrote:': 0.17; 'written': 0.20; 'subject:problem': 0.22; 'cc:2**0': 0.23; 'programming': 0.23; 'absolute': 0.23; 'bruce': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'cocoa': 0.29; 'parent': 0.29; 'releases,': 0.29; 'style.': 0.29; 'maybe': 0.29; 'e.g.': 0.30; 'primary': 0.30; '(2)': 0.32; 'mac': 0.32; 'received:209.85.160.46': 0.32; 'running': 0.32; 'could': 0.32; 'handle': 0.33; 'problem': 0.33; 'another': 0.33; 'version': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'architecture': 0.34; 'process,': 0.35; 'solving': 0.35; 'pm,': 0.35; 'remote': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'apple': 0.36; "didn't": 0.36; 'turn': 0.36; 'supporting': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'different': 0.63; 'more': 0.63; 'jul': 0.65; 'hand': 0.82; 'case?': 0.84; 'forced': 0.84; 'mac.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=5gFJW6o0rNDyKNMMYZhP2ecMQSV7L0+XHpxEXZ/Aq+o=; b=N7+Kwo6ZNOzz93eypVRXt33ma+XRBxe/Y+M1Wrt0hLdXZGmJPegky2aBvOvOnn6ycc aIQ917o5unPFFz2l0TPJ5F2/manXYljYPqiw4qOFyHBtJba1/ht34k8lTHwyQi5gNMqc nDpy9qZgCoMESKDy5qF2l4/Ix+WXdX+49wH+pb8+NIQWXOJv1obvdIPfCEHYAT+t/0ve aQVJVv8eWfYEpOGILhD4qZjtjv2CRfhUaMFiP6Bqvxxrm8ootHtdVhDWUng3JKeijhT3 U0lxLPDrBzH7nRzoT6TC0f4EwBnueAYfd4Pf/vehWRx7DA0xun64tj/31l0mAS64jzk+ g4/Q== MIME-Version: 1.0 In-Reply-To: References: <87a9yt7bw6.fsf@handshake.de> <2u8m085co3j3n97jorkl04o5hr1orqb7la@invalid.netcom.com> <5gfm08htgbrum782hfv5fqkb4084qra7vq@invalid.netcom.com> From: Devin Jeanpierre Date: Mon, 23 Jul 2012 01:50:12 -0400 Subject: Re: A thread import problem To: Bruce Sherwood Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343022655 news.xs4all.nl 6983 [2001:888:2000:d::a6]:56302 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25838 On Sun, Jul 22, 2012 at 7:14 PM, Bruce Sherwood wrote: > (2) My hand is forced by Apple no longer supporting Carbon. Among > other aspects of this, Carbon can't be used with 64-bit Python, and > more and more Mac users of VPython want to use 64-bit Python. So there > has to be a version of VPython that is based on Cocoa, but Cocoa is > required to be the primary thread. This requirement, combined with the > absolute requirement that the VPython API cannot be changed, is the > problem I face. I have to turn the architecture inside out, > independent of whether the solution meets all criteria for good Python > programming style. I had exactly this problem with Tkinter on Mac. The API involved "synchronous" calls to update a GUI written in tkinter, which ran in another thread (so e.g. students could call the API from the interactive interpreter). This didn't work on new Mac OS X releases, because Tkinter had to be run in the main thread after some update -- and also because of this deadlock issue with imports (but I didn't know that until later). I ended up solving it by running the Tkinter in the main thread of a different process, which could handle RPC invocations asynchronously, and sending remote invocations via a synchronous RPC library in the parent process. Maybe you can do something similar in your case? -- Devin