Bug 3896 - python-dbus: sending empty lists doesn't work
Summary: python-dbus: sending empty lists doesn't work
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Havoc Pennington
QA Contact:
Depends on:
Reported: 2005-07-28 03:49 UTC by Lennart Poettering
Modified: 2006-08-01 10:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Lennart Poettering 2005-07-28 03:49:35 UTC
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
Comment 1 Lennart Poettering 2005-07-28 03:51:51 UTC
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)
Comment 2 Lennart Poettering 2005-08-09 10:44:19 UTC
I opened a new bug report for this dbus.Byte(0) issue, which even contains a patch: 


Alas the empty list issue remains.
Comment 3 John (J5) Palmieri 2005-08-16 14:13:50 UTC
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.
Comment 4 Lennart Poettering 2005-08-16 14:19:08 UTC
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.