robshakir / pyangbind

A plugin for pyang that creates Python bindings for a YANG model.
Other
204 stars 121 forks source link

Pybind with error dictionary changed size during iteration #224

Open xijq227 opened 6 years ago

xijq227 commented 6 years ago

I'm trying to generate a class of openconfig-interfaces.yang with augment in openconfig-if-ip.yang

nexus@Nexus-XPS MINGW64 ~/Documents/NERA/Starhub/QFX Phase1B/NorthStar Appformix Demo Project
$ python --version
Python 2.7.14
(env)
nexus@Nexus-XPS MINGW64 ~/Documents/NERA/Starhub/QFX Phase1B/NorthStar Appformix Demo Project
$ pyang --version
pyang 1.7.5
(env)
$ pyang --plugindir env/Lib/site-packages/pyangbind/plugin/ -f pybind -o openconfig_interfaces.py -p yang_modules/ yang_modules/oc_models/interfaces/openconfig-interfaces.yang yang_modules/oc_models/interfaces/openconfig-if-ip.yang --lax-quote-checks
Traceback (most recent call last):
  File "C:/Users/nexus/DOCUME~1/NERA/Starhub/QFXPHA~1/NORTHS~1/env/Scripts/pyang", line 450, in <module>
    run()
  File "C:/Users/nexus/DOCUME~1/NERA/Starhub/QFXPHA~1/NORTHS~1/env/Scripts/pyang", line 419, in run
    emit_obj.emit(ctx, modules, fd)
  File "env/Lib/site-packages/pyangbind/plugin/pybind.py", line 222, in emit
    build_pybind(ctx, modules, fd)
  File "env/Lib/site-packages/pyangbind/plugin/pybind.py", line 406, in build_pybind
    build_identities(ctx, defn['identity'])
  File "env/Lib/site-packages/pyangbind/plugin/pybind.py", line 446, in build_identities
    idstore.build_store_from_definitions(ctx, defnd)
  File "C:\users\nexus\docume~1\nera\starhub\qfxpha~1\norths~1\env\lib\site-packages\pyangbind\helpers\identity.py", line 75, in build_store_from_definitions
    mod_ref_prefixes = module_import_prefixes(ctx)
  File "C:\users\nexus\docume~1\nera\starhub\qfxpha~1\norths~1\env\lib\site-packages\pyangbind\helpers\misc.py", line 24, in module_import_prefixes
    for mod in ctx.modules:
RuntimeError: dictionary changed size during iteration
RAMCCNA commented 5 years ago

Good Day, I too have the similar issue when attempting to create a binding.py

Administrator@WIN-9FK6N12 MINGW64 /pythonvenv $ py -V Python 2.7.15 (PY2-YA~1) Administrator@WIN-9FK6N12 MINGW64 /pythonvenv $ pyang --version pyang 1.7.5 (PY2-YA~1) Administrator@WIN-9FK6N12 MINGW64 /pythonvenv $ pyang --plugindir $PYBINDPLUGIN -f pybind -o ietf_ip_binding.py ietf-ip.yang ietf-interfaces.yang ietf-inet-types.yang ietf-yang-types.yang Traceback (most recent call last): File "C:/PROGRA~1/Git/PYTHON~1/PY2-YA~1/Scripts/pyang", line 450, in run() File "C:/PROGRA~1/Git/PYTHON~1/PY2-YA~1/Scripts/pyang", line 419, in run emit_obj.emit(ctx, modules, fd) File "C:\PROGRA~1\Git\PYTHON~1\PY2-YA~1\lib\site-packages\pyangbind/plugin\pybind.py", line 222, in emit build_pybind(ctx, modules, fd) File "C:\PROGRA~1\Git\PYTHON~1\PY2-YA~1\lib\site-packages\pyangbind/plugin\pybind.py", line 406, in build_pybind build_identities(ctx, defn['identity']) File "C:\PROGRA~1\Git\PYTHON~1\PY2-YA~1\lib\site-packages\pyangbind/plugin\pybind.py", line 446, in build_identities idstore.build_store_from_definitions(ctx, defnd) File "C:\progra~1\git\python~1\py2-ya~1\lib\site-packages\pyangbind\helpers\identity.py", line 75,in build_store_from_definitions mod_ref_prefixes = module_import_prefixes(ctx) File "C:\progra~1\git\python~1\py2-ya~1\lib\site-packages\pyangbind\helpers\misc.py", line 24, in module_import_prefixes for mod in ctx.modules: RuntimeError: dictionary changed size during iteration

Anyone have any input on what the issue may be? Thanks

Lancerzzzz commented 5 years ago

i have same issue?why?????

JoseIgnacioTamayo commented 8 months ago

Could you please try again with a recent / latest version of pyangbind?