python-dbus-next icon indicating copy to clipboard operation
python-dbus-next copied to clipboard

call_get_managed_object doesn't work

Open danaronson opened this issue 5 years ago • 2 comments

running the following code:

from dbus_next.aio import MessageBus
from dbus_next import BusType, Message
import asyncio

loop = asyncio.get_event_loop()

async def main():
    bus = await MessageBus(bus_type=BusType.SYSTEM).connect()

    introspection = await bus.introspect('org.bluez', '/org/bluez')
    db =  bus.get_proxy_object('org.bluez', '/org/freedesktop/DBus', introspection.default())
    object_manager = db.get_interface('org.freedesktop.DBus.ObjectManager')

    objects = await object_manager.call_get_managed_objects()
    await loop.create_future()

loop.run_until_complete(main())

generates a signature error: dbus_next.errors.DBusError: Method "GetManagedObjects" with signature "" on interface "org.freedesktop.DBus.ObjectManager" doesn't exist

Am I calling this incorrectly?

danaronson avatar Jul 22 '20 02:07 danaronson

Hi,

BlueZ Object Manager is on the root node only. You need to introspect and get proxy object of "/". Try this:

introspection = await bus.introspect('org.bluez', '/') db = bus.get_proxy_object('org.bluez', '/', introspection) object_manager = db.get_interface('org.freedesktop.DBus.ObjectManager')

rafalgajda-silvair avatar Jul 22 '20 06:07 rafalgajda-silvair

Does it advertise the interface and method on the path /org/bluez and say there's no method? That seems like a mistake on the server.

acrisci avatar Jul 22 '20 14:07 acrisci