[PEAK] Win32Reactor

Chad Rosenberg chad at idrankwhat.net
Fri Feb 27 17:35:13 EST 2004


Thanks.  Our components are assembled by ZConfig and something about 
offering the Win32 reactor as ITwistedReactor in our PEAK_CONFIG ini 
file brought out the problem.  Putting the following in the component 
that ZConfig builds solved it:

   _is_twisted = binding.Make(lambda: True, 
offerAs=['peak.events.isTwisted'])

Chad


On Feb 26, 2004, at 1:56 PM, Phillip J. Eby wrote:

> At 01:38 PM 2/26/04 -0800, Chad Rosenberg wrote:
>> Has anyone gotten Peak Events to work with the Win32Reactor?  I would 
>> otherwise happily use the default windows reactor (which seems to 
>> work), but I need access to the twisted Process Protocols.
>>
>> When I tried with the Win32Reactor, I got the following:
>>
>> ...
>>   File "c:\python23\Lib\site-packages\peak\events\io_events.py", line
>> 147, in runUntil
>
> This shows you're not using the Twisted reactor, but the built-in 
> peak.events EventLoop class in peak.events.io_events.  Evidently 
> you're scheduling things with the Twisted reactor directly, but the 
> EventLoop doesn't know anything about it.
>
> You need to have a component that either depends on 
> 'running.ITwistedReactor' or calls 'events.makeTwisted()' on itself at 
> component assembly time.
>
>
> Example:
>
> class MyAppClass(binding.Component):
>
>     reactor = binding.Obtain(running.ITwistedReactor, 
> uponAssembly=True)
>
> As long as an instance of this class is assembled before you use the 
> default EventLoop, your code will be switched to an EventLoop that 
> uses the Twisted reactor.  (EventLoop in peak.events.twisted_support.)
>
> _______________________________________________
> PEAK mailing list
> PEAK at eby-sarna.com
> http://www.eby-sarna.com/mailman/listinfo/peak




More information about the PEAK mailing list