python and the infamous event loop

Jacob Peddicord jpeddicord at
Sat Feb 14 11:56:45 PST 2009

I apologize in advance if this sounds like a rant.

First, up front, my question: Is there any way at all to use dbus and listen
for signals in Python *without* using glib?

I keep finding discussions dating to nearly three years ago about this
question[1]. Occasionally I see a post hinting that something will be
implemented in the future, but shortly after the thread is dead. Has there
been any progress? I've searched high and low for documentation and have
gone through the code, but I can't find anything. Other than DBusGMainLoop,
there has been nothing. Some of the code and docs suggest that something
could be done with NativeMainLoop, but I quickly found that it isn't
subclassable or usable itself. To top it off, dbus.set_default_main_loop
only wants an instance of NativeMainLoop.

Another option I see discussed is to just put the glib MainLoop in a thread
and set it off to the side to process. This would be feasible, but it
doesn't work. Calling dbus.mainloop.glib.threads_init results in:
  ** ERROR **: g_thread_init() must be called before dbus_threads_init()
g_thread_init is not exposed anywhere in the glib/dbus Python API (if it is,
it's not working).

Has anybody found a solution to this age-old problem?


-------------- next part --------------
An HTML attachment was scrubbed...

More information about the dbus mailing list