Skip to content

Errors parsing yaml lists of dictionaries #81

@sg3-141-592

Description

@sg3-141-592

Tested using niet ==3.2.0 and python 3.11.1

When trying to parse dictionaries that are in a list we get an error

niet -f eval . test.yaml
hello:
  world:
    - abc : 123
    - def : 456
Traceback (most recent call last):
  File "/workspace/.pyenv_mirror/user/3.11.1/bin/niet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/workspace/.pyenv_mirror/user/current/lib/python3.11/site-packages/niet/__init__.py", line 287, in main
    print_result(result, out_format, in_format, search, out_file)
  File "/workspace/.pyenv_mirror/user/current/lib/python3.11/site-packages/niet/__init__.py", line 226, in print_result
    output = VALID_PRINTERS[out_format]["cmd"](res, search)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/.pyenv_mirror/user/current/lib/python3.11/site-packages/niet/output.py", line 80, in print_eval
    results = _findevalitem(res, search)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/.pyenv_mirror/user/current/lib/python3.11/site-packages/niet/output.py", line 64, in _findevalitem
    item = _findevalitem(v, k)
           ^^^^^^^^^^^^^^^^^^^
  File "/workspace/.pyenv_mirror/user/current/lib/python3.11/site-packages/niet/output.py", line 69, in _findevalitem
    el.append("{k}=( {value} )".format(k=k, value=" ".join(v)))
                                                  ^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions