napalm-logs icon indicating copy to clipboard operation
napalm-logs copied to clipboard

dictionary keys changed during iteration

Open jeffmcadams opened this issue 3 years ago • 0 comments

Traceback (most recent call last):
  File "/root/python/napalm-logs/bin/napalm-logs", line 8, in <module>
    sys.exit(napalm_logs_engine())
  File "/root/python/napalm-logs/lib/python3.9/site-packages/napalm_logs/scripts/cli.py", line 459, in napalm_logs_engine
    nl.start_engine()
  File "/root/python/napalm-logs/lib/python3.9/site-packages/napalm_logs/base.py", line 706, in start_engine
    self._processes.append(self._start_dev_proc(device_os, device_config))
  File "/root/python/napalm-logs/lib/python3.9/site-packages/napalm_logs/base.py", line 651, in _start_dev_proc
    dos = NapalmLogsDeviceProc(device_os, self.opts, device_config)
  File "/root/python/napalm-logs/lib/python3.9/site-packages/napalm_logs/device.py", line 48, in __init__
    self._compile_messages()
  File "/root/python/napalm-logs/lib/python3.9/site-packages/napalm_logs/device.py", line 118, in _compile_messages
    for key in values.keys():
RuntimeError: dictionary keys changed during iteration

This seems to be triggered in at least Python 3.9 and I believe 3.8 by any file in "config/<OSname>/*.yaml" that has a key in the values dictionary with a "|" in it.

I've tried to dig into this, and honestly I can't figure out how this has ever worked in any python 3.x version if my understanding of the behavior is correct, but the code seems to be 5 years old.

jeffmcadams avatar Aug 18 '22 17:08 jeffmcadams