dasbus icon indicating copy to clipboard operation
dasbus copied to clipboard

Method “ListInhibitions” returned type “(a(ss))”, but expected “(a{ss})”

Open credomane opened this issue 1 year ago • 0 comments

I'm sure I'm doing something wrong but I can't figure it out. Is there some way for me to override the "expected" return type that I'm overlooking?

I'm on Arch Linux with dasbus installed through pacman.

This is my script

from dasbus.connection import SessionMessageBus
from dasbus.unix import GLibClientUnix
bus = SessionMessageBus()

#dbus-send --print-reply --dest=org.kde.Solid.PowerManagement.PolicyAgent /org/kde/Solid/PowerManagement/PolicyAgent org.kde.Solid.PowerManagement.PolicyAgent.ListInhibitions

proxy = bus.get_proxy(
    "org.kde.Solid.PowerManagement.PolicyAgent",
    "/org/kde/Solid/PowerManagement/PolicyAgent")

print(proxy.ListInhibitions())

I'm expecting to get a printout something like what dbus-send returns (my KDE dbus command is in the python file)

method return time=1714249844.635597 sender=:1.24 -> destination=:1.202 serial=1028 reply_serial=2
   array [
      struct {
         string "Steam"
         string "Client interface"
      }
   ]

Instead I'm getting this error:

Traceback (most recent call last):
  File "./main.py", line 12, in <module>
    print(proxy.ListInhibitions())
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dasbus/client/handler.py", line 450, in _call_method
    return self._get_method_reply(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dasbus/client/handler.py", line 483, in _get_method_reply
    return self._handle_method_error(error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dasbus/client/handler.py", line 518, in _handle_method_error
    raise error
  File "/usr/lib/python3.12/site-packages/dasbus/client/handler.py", line 480, in _get_method_reply
    result = call(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dasbus/client/handler.py", line 57, in sync_call
    return connection.call_sync(
           ^^^^^^^^^^^^^^^^^^^^^
gi.repository.GLib.GError: g-io-error-quark: Method “ListInhibitions” returned type “(a(ss))”, but expected “(a{ss})” (13)

credomane avatar Apr 27 '24 20:04 credomane