dbus python - Returning empty lists

Havoc Pennington hp at redhat.com
Wed May 16 11:43:15 PDT 2007


Hi,

Eyal Ben David wrote:
> My setup:
>   dbus service written in python (twisted + glib event loop)
>   dbus client implemented in C++
> 
> When I send an empty list the DBUS implementation can't handle the empty
> python list and emits an error.
> 
> My solution was to return None but then the caller must check the type
> of the return value for each call.
> 
> How can I return an empty list without causing an exception?
> 

There should not be an exception from dbus itself (empty arrays should 
be allowed), I'm guessing the exception is that the python bindings do 
not know the type of the list since there are no items in the list to 
look at. There is probably a way to tell the python bindings the type to 
use.

Havoc



More information about the dbus mailing list