JoelBender / BACpypes3

BACnet communications library
33 stars 7 forks source link

AttributeError: Sequence object has no attribute dict_contents #47

Open nveloso opened 1 month ago

nveloso commented 1 month ago

Hi! When I'm trying to call dict_contents() on a ReadPropertyMultipleACK object I get the following error:

  File "...", line 392, in _dict_contents
    apdu_contents = apdu.dict_contents()
  File "...python3.8/site-packages/bacpypes3/apdu.py", line 583, in dict_contents
    self.apdu_contents(use_dict=use_dict, as_class=as_class)
  File "...python3.8/site-packages/bacpypes3/apdu.py", line 1037, in apdu_contents
    Sequence.dict_contents(self, use_dict=use_dict, as_class=as_class)
AttributeError: type object 'Sequence' has no attribute 'dict_contents'

It looks like Sequence does not have a dict_contents method implemented.

JoelBender commented 2 days ago

The dict_contents() API is left over from "legacy" BACpypes and is a one-way mapping. BACpypes3 has a json API that has sequence_to_json() and json_to_sequence(). I would like to remove dict_contents() and the related functions like apdu_contents().