[Twisted-Python] Error "reactor already installed" - exact module import order?

Zoltan (Twisted Python Mailing List) twisted-matrix at mail11.ml1.net
Sat Oct 28 20:37:22 EDT 2006

Hi everyone,

I would be grateful if someone could help me with the error "reactor already 
installed". I have seen this issue has been discussed previously, but I am not 
sure how to fix appropriate file so that error does not occur anymore.

I am using Twisted Python 2.4.0, as it is packaged by Mandriva.

Here is the Python stack trace:
----------------- cut 8< -------------------
Traceback (most recent call last):
   File "/usr/bin/pyscrabble.py", line 4, in ?
   File "/usr/lib/python2.4/site-packages/twisted/internet/gtk2reactor.py", 
line 270, in install
   File "/usr/lib/python2.4/site-packages/twisted/internet/main.py", line 23, 
in installReactor
     assert not sys.modules.has_key('twisted.internet.reactor'), \
AssertionError: reactor already installed
----------------- cut 8< -------------------

Here is the piece of code that causes error:

----------------- /usr/bin/pyscrabble.py -------------------
#!/usr/bin/env python

from twisted.internet import gtk2reactor
----------------- /usr/bin/pyscrabble.py -------------------

As for the "pyscrabble.py" causing, I'll contact its author, but is it possible 
to change ".../twisted/internet/main.py" so that it does not throw assertion 
error on already installed reactor?

Many thanks in advance,


More information about the Twisted-Python mailing list