ldo / dbussy

Python binding for D-Bus using asyncio
91 stars 22 forks source link

Adding argument of an Array of Dictionaries leads to AttributeError #46

Closed agners closed 3 years ago

agners commented 3 years ago

When trying to add an array of dictionaries as an argument append_objects() throws an exception:

>>> request = dbussy.Message.new_method_call(..)
>>> request.append_objects("aa{si}", [ { "a": 12, "b": 12 } ])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sag/.local/lib/python3.9/site-packages/dbussy.py", line 4451, in append_objects
    append_sub(parse_signature(signature), args, self.iter_init_append())
  File "/home/sag/.local/lib/python3.9/site-packages/dbussy.py", line 4415, in append_sub
    if type_is_fixed_array_elttype(arrelttype.code.value) :
AttributeError: 'DictType' object has no attribute 'code'
ldo commented 3 years ago

I think I have fixed this: the problem is that DictType was forgetting to call the init for the Type superclass. See if it works now.

agners commented 3 years ago

Yes, that did the trick! Thanks!