[Pythonmac-SIG] how do I use twisted cfreactor?
Bob Ippolito
bob at redivi.com
Fri Jan 14 21:53:17 CET 2005
The issue you're having sounds like it's either something really easy
or really hard to fix. If you post code I'll track it down, but I
don't have the time this weekend to debug-by-mail.
Your crash aside, it should be done in this order:
1) Install cfreactor
2) Load up all the classes
3) AppHelper.runEventLoop
4) From 'applicationDidFinishLaunching:' do any Twisted stuff. You
*should* call reactor.run() at the end. It doesn't actually block
because it integrates into the NSRunLoop, but it should still be
called.
-bob
On Jan 14, 2005, at 15:32, Kevin Dangoor wrote:
> Replying to myself is always fun.
>
> I decided to try a more minimal test, eliminating everything but
> PyObjC and Cheetah. It does indeed appear to be the case that I get a
> Bus Error if I render a Cheetah template from within an action called
> by a menu item. This happens even when Cheetah is 100% python.
>
> The bus error occurs after my action returns. This leads me to believe
> that either there's something else I need to do in my class to handle
> that action properly, or there is a bug in Cheetah or PyObjC.
>
> Even though Twisted is not at all at issue here, I'd still be curious
> to hear if I'm setting up event handling properly...
>
> Kevin
>
> Kevin Dangoor wrote:
>
>> I'm trying to mix Twisted and a Mac interface. I'm using PyObjC
>> 1.2 and Twisted's trunk as of a few days back. All of this with
>> Python 2.3. The combo appeared to be working until this morning.
>> Intriguingly, the problem appeared when I added Cheetah (the template
>> engine) to the mix. If I remove Cheetah *or* I remove PyObjC,
>> everything appears to be happy.
>>
>> The basic order in which I'm doing things is:
>> 1) install cfreactor,
>> 2) load up my nib-based controller class,
>> 3) tell the reactor to start listening on a TCP port,
>> 4) (reactor.run) -- I had this line in there but then removed it
>> without a difference in behavior
>> 5) AppHelper.runEventLoop
>>
>> I'm not exactly sure how or why introducing Cheetah could have this
>> effect. I even moved Cheetah's one C module out of the way (falling
>> back to straight Python code), but that didn't seem to have an
>> effect. I figured it was time to double check that I'm doing the
>> right things in getting things running.
>>
>> Is there anything glaringly obvious in that list of steps that should
>> be different or in a different order?
More information about the Pythonmac-SIG
mailing list