[PyQt] PyQt4 dbus mainloop assertion error

Ingmar Steen iksteen at gmail.com
Wed Apr 25 18:45:37 BST 2007


On 4/25/07, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
>
> On Wednesday 25 April 2007 3:44 pm, Ingmar Steen wrote:
> > Hi,
> >
> > I'm trying to use the new PyQt4 dbus mainloop, but it crashes with an
> > assertion error when I try to get an object from the bus. I'm using Sip
> > 4.6, PyQt4.2, Qt 4.2.3, Python 2.5.1, DBus 1.0.2 and dbus-python 0.80.1.
> Am
> > I doing something fundamentally insane or wrong?
> >
> > If I remove the QDBusQtMainLoop(set_as_default=True) line, it works just
> > fine. The assertion also happens if app.exec_() and get the bus object
> from
> > a QTimer event.
> >
> > Anybody got any ideas?
>
> You could try a later version of dbus-python.
>
> Can you produce a glib version? It that does the same then at least it's
> not a
> PyQt problem.
>
> Phil


I upgraded dbus-python to 0.80.2 (even rebuilt python, sip and pyqt4 from
scratch) with the same result.

A glib version of the same test application works as expected (as do more
complex glib-python-dbus apps).

I've also reviewed the package sources of my distribution's Qt4 and DBus
packages... No fancy patches or other magic there. The only thing I can
personally think of is that Qt4 is compiled with glib mainloop support
(which sort of works, I can use the dbus glib mainloop in PyQt4 apps, but
QCoreApplication.exec_() never quits).

Ingmar


test_glib.py:
from dbus.mainloop.glib import DBusGMainLoop
import dbus, sys, gobject
loop = gobject.MainLoop()
DBusGMainLoop(set_as_default = True)
print 'getting bus'; bus = dbus.SystemBus()
print 'getting obj'; obj = bus.get_object('org.bluez', '/org/bluez')
print 'done'

output:
getting bus
getting obj
done
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070425/5864ff25/attachment.html


More information about the PyQt mailing list