[PEAK] StopIteration: Unexpected reactor exit

John Landahl john at landahl.org
Thu Mar 25 16:11:01 EST 2004

On Thu, 25 Mar 2004 08:47:31 -0500, Phillip J. Eby <pje at telecommunity.com> 

> That's because Twisted insists on having only one reactor.  If you want 
> more than one (and if you have nested event loops, then you do), all but 
> one have to be "untwisted".

The event sources I'm wrapping with EventLoop.runUntil are deferreds, so 
the untwisted reactor wouldn't work.

>> I know this isn't much to go on, but perhaps it's just something simple 
>> I've overlooked...
> It may be that nested event loops aren't what you actually want or 
> need.  You should only need a nested event loop if you have 
> *synchronous* code that is sandwiched between an asynchronous caller and 
> an asynchronous callee.  If you can make that synchronous code 
> asynchronous, the need for a nested event loop goes away.

What about for a synchronous caller and asynchronous callees?  Something 

   func1   (synchronous)
     func2 (synchronous)
       reactor.spawnProcess (asynchronous)
       PB call (asynchronous)

func2 works on the data from the two asynchronous sources and returns its 
results to func1.  Is there something other than EventLoop.runUntil that 
can make this possible?  Since func2 needs to be synchronous, it can't be 
converted to a generator Task.

More information about the PEAK mailing list