[Twisted-Python] How can I make twisted and dbus work together?

Justin Warren daedalus at eigenmagic.com
Wed Jan 16 00:18:19 MST 2008


On Wed, 2008-01-16 at 17:28 +1100, hwan2265 at mail.usyd.edu.au wrote:

> But when I was running my code, I got a error:
> 
> Traceback (most recent call last):
>   File "dbustwisted.py", line 5, in <module>
>     glib2reactor.install()
>   File "/usr/lib/python2.5/site-packages/twisted/internet/glib2reactor.py",
> line 33, in install
>     return gtk2reactor.install(False)
>   File "/usr/lib/python2.5/site-packages/twisted/internet/gtk2reactor.py",
> line 270, in install
>     installReactor(reactor)
>   File "/usr/lib/python2.5/site-packages/twisted/internet/main.py", line
> 24, in installReactor
>     "reactor already installed"
> AssertionError: reactor already installed

I suspect your problem may be here:

> if __name__ == "__main__":
>     from twisted.internet import glib2reactor
>     glib2reactor.install()
>     ################################################
>     # I added the 2 lines here and made the program crash
>     ################################################
> 
>     from twisted.internet import reactor
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You've already imported glib2reactor, so you shouldn't import the
default reactor as well. Try removing this line.

-- 
Justin Warren <daedalus at eigenmagic.com>




More information about the Twisted-Python mailing list