Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error when merging 2 lists of dicts #162

Closed
@kviktor

Description

@kviktor

I have this simple test program

import dpath.util

a = [{"hello": "bello"}]
b = [{"just": "testing"}]
print(dpath.util.merge(a, b))

It gives the following error:

Traceback (most recent call last):
  File "/home/kviktor/test.py", line 5, in <module>
    print(dpath.util.merge(a, b))
  File "/home/kviktor/.local/lib/python3.10/site-packages/dpath/util.py", line 353, in merge
    merger(dst, filtered_src)
  File "/home/kviktor/.local/lib/python3.10/site-packages/dpath/util.py", line 293, in merger
    if len(key) == 0 and not options.ALLOW_EMPTY_STRING_KEYS:
TypeError: object of type 'int' has no len()

Removing https://github.com/dpath-maintainers/dpath-python/blob/master/dpath/util.py#L293-L296 fixes the issue but not sure if my case should even work.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions