[Twisted-web] Nevow importing reactor?

James Y Knight foom at fuhm.net
Tue Jul 26 08:15:37 MDT 2005

On Jul 26, 2005, at 9:50 AM, Phil Mayers wrote:
> Is this bad?
> http://divmod.org/users/roundup.twistd/nevow/issue211
> Twisted says:
> http://twistedmatrix.com/projects/core/documentation/howto/choosing- 
> reactor.html
> """IMPORTANT: installing a reactor should be the first thing done  
> in the app, since any code that does from twisted.internet import  
> reactor will automatically install the default reactor if the code  
> hasen't already installed one."""
> It doesn't explicitly state the converse, that the framework should  
> not cause a reactor to be installed, but I've seen plenty of code  
> that "defers" importing twisted.internet.reactor.
> If it's not a bug then ignore, but if it's a trivial fix then...?

Framework code that gets imported by the reactor you want to install  
*must* not cause the default reactor to get installed, of course (nor  
must any framework code which is imported by twisted.scripts.twistd).  
However, as far as I know any other framework code may import it  
whenever desired.

If it's a trivial fix and a patch is supplied I don't suppose anyone  
would mind applying it, but I don't think there's much point. Just  
follow the advise above and you should be all set no matter what.


More information about the Twisted-web mailing list