Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist

Viewed 156

I am developing bluez and dbus software in python for automated testing purposes. Recently one of my methods: isconnected(), which checks the property "Connected" of all managed objects, has been throwing errors. Pasting the error below:


ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/pi/.local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/home/pi/.local/lib/python3.9/site-packages/fastapi/applications.py", line 269, in __call__
    await super().__call__(scope, receive, send)
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/exceptions.py", line 93, in __call__
    raise exc
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    await self.app(scope, receive, sender)
  File "/home/pi/.local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/home/pi/.local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/routing.py", line 670, in __call__
    await route.handle(scope, receive, send)
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/routing.py", line 266, in handle
    await self.app(scope, receive, send)
  File "/home/pi/.local/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/home/pi/.local/lib/python3.9/site-packages/fastapi/routing.py", line 227, in app
    raw_response = await run_endpoint_function(
  File "/home/pi/.local/lib/python3.9/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
  File "./app.py", line 46, in disconnectall
    bluez.disconnectall()
  File "./bluez.py", line 303, in disconnectall
    if isconnected(bdaddr):
  File "./bluez.py", line 318, in isconnected
    isconnected = getinterface.Get(bluetooth_constants.DEVICE_INTERFACE, connected)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 72, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist

Here is isconnected():

def isconnected (bdaddr):
    connected = 'Connected'
    device_path = bluetooth_utils.device_address_to_path(bdaddr, mybus.adapter_path_1)
    device_proxy = mybus.bus.get_object(bluetooth_constants.BLUEZ_SERVICE_NAME,device_path)
    getinterface  = dbus.Interface(device_proxy, bluetooth_constants.DBUS_PROPERTIES)
    isconnected = getinterface.Get(bluetooth_constants.DEVICE_INTERFACE, connected)
    return isconnected


Any ideas on what is happening?

1 Answers

That just means you are calling a methods on an object that is currently not on the dbus. In other words you need to run a discovery first...

Related