dbus call into a program -> hangs
kacperw at online.no
Sat Nov 18 04:00:05 PST 2006
On 11/18/06, Simon McVittie <simon.mcvittie at collabora.co.uk> wrote:
> On Fri, 17 Nov 2006 at 22:54:46 +0100, Kacper Wysocki wrote:
> > this application is the Gnome Meld visual diff program, which is, as
> > it happens, implemented in python.
> Ah, Python. The usual dbus-python problem is not having an "import dbus.glib"
> before you use D-Bus for the first time.
> When this module is imported, some magic happens and the GLib main
> loop is connected up to all Bus objects created in future. Any Bus
> objects created before you import dbus.glib will not be able to make
> async method calls, receive signals, or export objects as a service.
> I realise this isn't a nice or intuitive API, and earlier today I was working
> on improving it for dbus-python 0.80 (at the very least, trying to construct
> a Bus that won't actually work should raise an exception). For the moment
> you're stuck with it, though.
my problem was indeed as trivial as not importing dbus.glib. 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 suppose
signals are useful without dbus.glib though) instead of having app
programmers scratch their heads when the thing blocks forever.
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.
More information about the dbus