Skip to content

print_file() throws when used with "with_siblings" #65

Open
@tbsuht

Description

@tbsuht
>>> with sess.get_data_ly("/*") as data:
...    data.print_file(sys.stdout, fmt="json", pretty=True)
...
{

}
>>> with sess.get_data_ly("/ietf-hardware:*") as data:
...    data.print_file(sys.stdout, fmt="json", pretty=True)
...
{
  "ietf-hardware:hardware": {
    "component": [
      {
       ...
      }
    ]
  }
}
>>> with sess.get_data_ly("/*") as data:
...    data.print_file(sys.stdout, fmt="json", pretty=True, with_siblings=True)
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/opt/venv/rmi/lib/python3.11/site-packages/libyang/data.py", line 676, in print_file
    raise self.context.error("cannot print node")
libyang.util.LibyangError: cannot print node
>>>

I'm not sure why the first call returns an empty object, as ietf-hardware contains data? And with the with_siblings option set, the call is crashing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions