If I try to call a remote DBUS method with an empty string array as argument with python-dbus I always get an IndexError on the client side: File "dbus_bindings.pyx", line 878, in dbus_bindings.MessageIter.append File "dbus_bindings.pyx", line 1033, in dbus_bindings.MessageIter.append_array IndexError: list index out of range
A related bug: if I try to send a dbus.Byte(0), I get nearly the same error. (Though dbus.UInt32(0) and friends work)
I opened a new bug report for this dbus.Byte(0) issue, which even contains a patch: https://bugs.freedesktop.org/show_bug.cgi?id=4023 Alas the empty list issue remains.
This should be in cvs shortly. To do this you can specify signitures or types: dbus.Array([], signiture="s") #empty array of strings dbus.Array([], signiture="(ii)") #empty array of a struct containing two int32's dbus.Array([], type=dbus.String) #empty array of strings dbus.Array([], type=dbus.Struct((dbus.Int32, dbus.Int32))) # not sure if this will work but it should - empty array of a struct containing two int32's Varients work the same way. Dictionaries are a bit different: dbus.Dictionary({}, signiture="ss") #an empty dictionary containing string key's and string values dbus.Dictionary({}, key_type=dbus.String, value_type=dbus.String) #an empty dictionary containing string key's and string values Note that you can not specify both types and signatures.
I hope the typo "signiture" is just in this bug report and not in the code?
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.