dbus call into a program -> hangs

Simon McVittie simon.mcvittie at collabora.co.uk
Sat Nov 18 10:05:25 PST 2006

On Sat, 18 Nov 2006 at 13:00:05 +0100, Kacper Wysocki wrote:
> It would
> obviously be better to raise an exception in this case, or include the
> dbus.glib bindings by default together with dbus.service

I'm not going to make dbus.service do the same magic, since I'm adding
support for main loops other than the default GLib mainloop context. The
API will be something along the lines of:

	from dbus import Bus, SessionBus
	from dbus.mainloop.glib import DBusGMainloop
	my_main_context = g_main_context(...)

	# either...
	bus = SessionBus(mainloop=DBusGMainloop(my_main_context))
	# or...
	bus = SessionBus()


so that you can also do something like:

	from dbus import SessionBus
	from dbus.mainloop.qt import dbus_qt_mainloop
	bus = SessionBus(mainloop=dbus_qt_mainloop)


	from dbus import SessionBus
	from dbus.mainloop.simple import SimpleDBusMainLoop
	mainloop = SimpleDBusMainLoop()	# a simple pure-Python main loop
	bus = SessionBus(mainloop=mainloop)

or even:

	from dbus import SessionBus
	from dbus.mainloop.twisted import TwistedDBusMainLoop
	reactor = (...)
	bus = SessionBus(mainloop=TwistedDBusMainLoop(reactor))

I don't currently plan to include the Qt support in dbus-python, to avoid
depending on Qt at build time, but it ought to be possible to have it as an
optional add-on. A simple pure-Python main loop, and Twisted and GLib
support, will ship with dbus-python 0.80 if at all possible; dbus-python
won't depend on Twisted, but including optional Twisted support will let
it integrate with a large number of main loops, including Qt, with minimal

> While we're on the subject of the python bindings: as in an earlier
> post of mine, the Python-dbus tutorial examples need to be slightly
> fixed to change all references of "bus.bus" to "bus", otherwise these
> examples won't run.

The tutorials will need updating for 0.80 in any case, since the API's
changed (incompatibly, in places), so for the moment I'm concentrating
on getting 0.80 implemented.


More information about the dbus mailing list