LEW21 / pydbus

Pythonic DBus library
GNU Lesser General Public License v2.1
326 stars 76 forks source link

Methods returning non-trivial types fail #69

Closed nburkitt closed 6 years ago

nburkitt commented 6 years ago

I'm using Python 3.4. I don't know the version of pydbus as I was unable to find a documented method for discovering it. Methods that return simple types (e.g. "i", "s", "d") work as expected, but methods that return structs (e.g. "(ddd)") fail.

As an example, my (Linux) service publishes an object.method Imu.GetOrientation that returns three doubles.

Introspection via qdbus returns:

method QDBusRawType::(ddd) com.xxx.yyy.v1.GetOrientation()

pydbus reports the same signature:

import pydbus BusAddress = "xxx" BusName = "yyy" bus = pydbus.connect( BusAddress ) Imu = bus.get( BusName, '/IMU' ) help(Imu.GetOrientation)

Help on method GetOrientation in module pydbus.proxy_method: GetOrientation() -> (ddd) method of DBUS. instance

Attempting to call the method returns:

Imu.GetOrientation()

Traceback (most recent call last): File "", line 1, in File "/root/hb/lib/python3.4/site-packages/pydbus/proxy_method.py", line 75, in call 0, timeout_to_glib(timeout), None).unpack() gi._glib.GError: Method 'GetOrientation' returned type '(ddd)', but expected '((ddd))'

Calling the same method via qdbus returns the three doubles and no complaints.

nburkitt commented 6 years ago

Oh, never mind. The problem was actually that my application was NOT returning an object, but a sequence of basic types.