[PEAK] Win32Reactor

Phillip J. Eby pje at telecommunity.com
Thu Feb 26 16:56:47 EST 2004


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.)




More information about the PEAK mailing list