06-05-2023 01:47 AM
Hello,
We are seeing below errors when trying to generate .java classes from yang files using jnc
pyang -f jnc --jnc-output src/gen
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 800, in _search
iterate(stmt.i_children, acc)
AttributeError: i_children
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 552, in pairwise
item = next(iterator) # throws StopIteration if empty.
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/pyang", line 493, in
run()
File "/usr/local/bin/pyang", line 462, in run
emit_obj.emit(ctx, modules, fd)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 208, in emit
self.generate_from(module)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 247, in generate_from
generator.generate()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 998, in generate
self.generate_classes()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1097, in generate_classes
child_generator.generate()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1000, in generate
self.generate_class()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1202, in generate_class
field = self.generate_child(ch)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1286, in generate_child
child_gen = MethodGenerator(sub, self.ctx)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1884, in init
search(stmt, yangelement_stmts | leaf_stmts)]
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 804, in search
search(stmt, keywords, dict)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 802, in _search
iterate(stmt.substmts, acc)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 779, in iterate
key = ' '.join([ch.keyword, camelize(ch.arg)])
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 589, in camelize
for character, next_character in iterator:
RuntimeError: generator raised StopIteration
Please help identify the exact error here. The error is seen for only a handful of yang files. For remaining yang files, the java classes are generated without any errors/warnings.
Thanks,
Shrikant
Solved! Go to Solution.
06-07-2023 04:11 AM
Seems like the issue was with Python version(3.7). Followed the solution mentioned in link and the issue was fixed.
06-06-2023 10:38 PM
Do you get this error for any YANG model or is it some specific models that this happens with?
06-06-2023 10:40 PM
Have you asked your question on https://github.com/tail-f-systems/JNC/issues ?
06-06-2023 10:53 PM
I had posted it on discussions page https://github.com/tail-f-systems/JNC/discussions/134
Now I posted on the issues page https://github.com/tail-f-systems/JNC/issues/135
Thank you
06-06-2023 10:41 PM
I got this error for a few of the yang models like tailf-ncs.yang. Other yang models are being converted to POJO just fine.
06-07-2023 04:11 AM
Seems like the issue was with Python version(3.7). Followed the solution mentioned in link and the issue was fixed.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide