Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1905

QDBusAbstractInterface::call only accepts 6 arguments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • None
    • 6.3.0
    • PySide
    • None
    • Linux/X11
    • e4a8e8a139 (pyside/pyside-setup/dev) aeafc8eacd (pyside/pyside-setup/6.3) ef7cb23a10 (pyside/pyside-setup/6.2) ef7cb23a10 (pyside/tqtc-pyside-setup/6.2) aeafc8eacd (pyside/tqtc-pyside-setup/6.3) e4a8e8a139 (pyside/tqtc-pyside-setup/dev)

    Description

      This code:

      # from PyQt6.QtCore import QVariant, QMetaType
      # from PyQt6.QtWidgets import QApplication
      # from PyQt6.QtDBus import QDBusInterface, QDBusConnection, QDBus, QDBusMessage, QDBusArgument
      
      from PySide6.QtWidgets import QApplication
      from PySide6.QtDBus import QDBusInterface, QDBusConnection, QDBus, QDBusMessage
      
      SERVICE = "org.freedesktop.Notifications"
      PATH = "/org/freedesktop/Notifications"
      INTERFACE = SERVICE
      
      app = QApplication([])
      bus = QDBusConnection.sessionBus()
      iface = QDBusInterface(SERVICE, PATH, INTERFACE, bus)
      assert iface.isValid(), iface.lastError()
      
      iface.call(
          QDBus.CallMode.Block,
          "Notify",
          "test",  # app name
          0,  # replaces_id
          "",  # icon filename
          "title",
          "body",
          [],  # actions
          {},  # hints
          -1,  # timeout
      )
      

      works fine with PyQt6, but with PySide6, it raises:

      Traceback (most recent call last):
        File "/home/florian/proj/qt/dev6/pyside-setup/test.py", line 17, in <module>
          iface.call(
      TypeError: call expected at most 6 arguments, got 10
      

      yet the Qt docs have an overload taking an arbitrary number of arguments, noting that:

      Note: Before Qt 5.14, this function accepted a maximum of just eight (8) arguments.

      As a workaround, using:

      iface.callWithArgumentList(
          QDBus.CallMode.Block,
          "Notify",
          [
              "test",  # app name
              0,  # replaces_id
              "",  # icon filename
              "title",
              "body",
              [],  # actions
              {},  # hints
              -1,  # timeout
          ]
      )
      

      seems to work fine (other than PYSIDE-1319).

      Attachments

        1. pyside1905.py
          0.9 kB
          Friedemann Kleint

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              the compiler Florian Bruhin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: