Dazl Library - Da-Marketplace Integration - unhashable type: 'dict'

I wrote a python integration to obtain data from an external API with DA Marketplace using the Dazl library and I’m getting the following error log:

Traceback (most recent call last):
  File ".../bot.py", line 41, in <module>
    asyncio.run(main())
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File ".../bot.py", line 23, in main
    async for event in stream.events():
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/aio/__init__.py", line 134, in events
    async for item in self.items():
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/grpc/conn_aio.py", line 692, in items
    async for event in self._acs_events(tx_filter_pb):
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/grpc/conn_aio.py", line 740, in _acs_events
    c_evt = await self.conn.codec.decode_created_event(event)
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/grpc/codec_aio.py", line 242, in decode_created_event
    cdata = await self.decode_value(con(cid.value_type), event.create_arguments)
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/grpc/codec_aio.py", line 338, in decode_value
    return await self._loader.do_with_retry(
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/aio/pkgloader.py", line 76, in do_with_retry
    return fn()
  File "/usr/local/lib/python3.9/site-packages/dazl/ledger/grpc/codec_aio.py", line 339, in <lambda>
    lambda: self._decode_context.convert(item_type, obj)
  File "/usr/local/lib/python3.9/site-packages/dazl/values/context.py", line 72, in convert
    return self.mapper.data_record(self, dt, dt.record, obj)
  File "/usr/local/lib/python3.9/site-packages/dazl/values/protobuf.py", line 52, in data_record
    value = context.append_path(name).convert(fld_metadata.type, fld_data.value)
  File "/usr/local/lib/python3.9/site-packages/dazl/values/context.py", line 105, in convert
    return self.mapper.prim_gen_map(
  File "/usr/local/lib/python3.9/site-packages/dazl/values/protobuf.py", line 132, in prim_gen_map
    obj[key] = value
TypeError: unhashable type: 'dict'

After some investigation, I came across the reason for the error shown, it being a dictionary with the structure of a Claim from the ContigentClaims Library, like so:

{'Zero': {}}

This error seems to be coming from the Dazl library, can you help me with this issue?

Thanks for reporting; at first blush I agree; looks like a serialization bug in dazl. Will look into it.

Hey @Luis_Almeida, can you let us know which version of dazl you are using?

Hi, I’m using version 7.5.9. I’ll try it out with the latest version and get back to you.

Many thanks, that seems to have fixed it. Thank you for your time.

1 Like

Great, I’m glad to hear it!