DBus & Python

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Apr 2 10:28:53 PDT 2007


On Mon, 02 Apr 2007 at 16:17:23 +0000, Robert Rawlins wrote:
> I'm trying to use Dbus to work with the bluez API and i've been having all sorts of problems getting it up and running. I've tried reinstalling Python, Dbus, DBus-gLib and Dbus-Python a few times this morning on my slackware box with a bunch of different results. Some of the error messages we've been getting are:

> /usr/local/lib/python2.5/site-packages/dbus/exceptions.py:8: RuntimeWarning: Python C API version mismatch for module _dbus_bindings: This Python has API version 1013, module _dbus_bindings has version 1012.

You're trying to use a copy of dbus-python compiled against Python 2.4,
with the Python 2.5 executable. Or something. Python has versioned
library directories, so I have no idea how you managed that... you must
have had used lots of ingenuity. Compiled Python extensions are only compatible
with one version of the interpreter, so if you have multiple Pythons
installed, you may want to install the extension multiple times.

For your reference, the correct order of installation is:

Python and D-Bus first
dbus-glib after D-Bus
dbus-python after all of D-Bus, dbus-glib and Python

You need to install dbus-python once per major version of Python on
your system with which you want to use D-Bus, e.g. if you have 2.4 in /usr and
2.5 in /usr/local you'd do:

PYTHON=/usr/bin/python2.4 ./configure --prefix=/usr (...etc...)
make
su -c 'make install'
make distclean
PYTHON=/usr/local/bin/python2.5 ./configure --prefix=/usr/local (...etc...)
make
su -c 'make install'

It's probably necessary to use the same --prefix for dbus-python that you used
for the corresponding Python installation. I don't know. You're using
Slackware, so presumably you're used to this sort of thing...

Regards,
	Simon


More information about the dbus mailing list