A dbus.mainloop.NativeMainLoop instance is required [Was: Re: dbus-python: support for Windows and OS X]

Pavel Strashkin pavel.strashkin at gmail.com
Wed Feb 2 23:24:56 PST 2011


i.e. not implemented, right?

2011/2/3 Ralf Habacker <ralf.habacker at freenet.de>:
> Am 02.02.2011 19:16, schrieb Lukas Hetzenecker:
>>
>> I was able to compile dbus and dbus-python on Windows without any
>> problems,
>> but now I get strange error messages when I try to create a D-Bus service:
>>
>> Windows XP; dbus 1.4.1-2
>>
>> C:\Python27\Lib\site-packages\dbus>C:\Python27\python.exe
>> Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit
>> (Intel)]
>> on win32
>>
>>>>> import sys
>>>>> import dbus
>>>>> import dbus.service
>>>>> import dbus.mainloop.qt
>>>>> from PyQt4 import QtCore
>>>>>
>>>>> app = QtCore.QCoreApplication(sys.argv)
>>>>> mainloop = dbus.mainloop.qt.DBusQtMainLoop(set_as_default=True)
>>>>> sb = dbus.SessionBus()
>>>>> name = dbus.service.BusName("net.sourceforge.series60remote", sb)
>>
>>>>> obj = dbus.service.Object.__init__(dbus.service.Object(), sb,
>>
>> '/Series60Remote')
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in<module>
>>   File "C:\Python27\lib\site-packages\dbus\service.py", line 480, in
>> __init__
>>     self.add_to_connection(conn, object_path)
>>   File "C:\Python27\lib\site-packages\dbus\service.py", line 571, in
>> add_to_connection
>>     self._fallback)
>> RuntimeError: To make asynchronous calls, receive signals or export
>> objects,
>> D-Bus connections must be attached to a main loop by passing mainloop=...
>> to
>> the constructor or calling dbus.set_default_main_loop(...)
>>
>> But when I try to call dbus.set_default_main_loop I get this error:
>>
>>>>> dbus.set_default_main_loop(mainloop)
>>
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in<module>
>> TypeError: A dbus.mainloop.NativeMainLoop instance is required
>>
>>
>> which is really odd, because mainloop is an instance of
>> dbus.mainloop.NativeMainLoop:
>
> maybe this is because the Native mainloop implementation in
> http://cgit.freedesktop.org/dbus/dbus-python/tree/_dbus_bindings/mainloop.c
> is a noop ?
>
> /* Null mainloop implementation ===================================== */
>
> static dbus_bool_t
> noop_main_loop_cb(void *conn_or_server UNUSED, void *data UNUSED)
> {
>    return TRUE;
> }
>
> #define noop_conn_cb ((dbus_bool_t (*)(DBusConnection *, void
> *))(noop_main_loop_cb))
> #define noop_server_cb ((dbus_bool_t (*)(DBusServer *, void
> *))(noop_main_loop_cb))
>
>
> Regards
>
> Ralf
>
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>


More information about the dbus mailing list