# Buggy code
def update_views(self):
    """Default builder fo the stats views.

    The V of MVC
    A dict of dict with the needed information to display the stats.
    Example for the stat xxx:
    'xxx': {'decoration': 'DEFAULT',
            'optional': False,
            'additional': False,
            'splittable': False}
    """
    ret = {}

    if (
        isinstance(self.get_raw(), list)
        and self.get_raw() is not None
        and self.get_key() is not None
    ):
        # Stats are stored in a list of dict (ex: NETWORK, FS...)
        for i in self.get_raw():
            ret[i[self.get_key()]] = {}
            for key, _ in i.items():
                value = {
                    "decoration": "DEFAULT",
                    "optional": False,
                    "additional": False,
                    "splittable": False,
                }
                ret[i[self.get_key()]][key] = value
    elif isinstance(self.get_raw(), dict) and self.get_raw() is not None:
        # Stats are stored in a dict (ex: CPU, LOAD...)
        for key, _ in self.get_raw().items():
            value = {
                "decoration": "DEFAULT",
                "optional": False,
                "additional": False,
                "splittable": False,
            }
            ret[key] = value

    self.views = ret

    return self.views


# Traceback (RuntimeError)
python -m glances --export-influxdb
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/nicolargo/Dropbox/dev/glances/glances/__main__.py", line 38, in <module>
glances.main()
File "glances/__init__.py", line 124, in main
standalone.serve_forever()
File "glances/standalone.py", line 107, in serve_forever
return self.__serve_forever()
File "glances/standalone.py", line 88, in __serve_forever
self.stats.update()
File "glances/stats.py", line 165, in update
self._plugins[p].update()
File "glances/plugins/glances_plugin.py", line 650, in wrapper
ret = fct(*args, **kw)
File "/home/nicolargo/Dropbox/dev/glances/glances/plugins/glances_load.py", line 109, in update
self.update_views()
File "/home/nicolargo/Dropbox/dev/glances/glances/plugins/glances_load.py", line 116, in update_views
super(Plugin, self).update_views()
File "glances/plugins/glances_plugin.py", line 300, in update_views
for key in iterkeys(self.get_raw()):
RuntimeError: dictionary changed size during iteration

# Fixed code
def update_views(self):
    """Default builder fo the stats views.

    The V of MVC
    A dict of dict with the needed information to display the stats.
    Example for the stat xxx:
    'xxx': {'decoration': 'DEFAULT',
            'optional': False,
            'additional': False,
            'splittable': False}
    """
    ret = {}

    if (
        isinstance(self.get_raw(), list)
        and self.get_raw() is not None
        and self.get_key() is not None
    ):
        # Stats are stored in a list of dict (ex: NETWORK, FS...)
        for i in self.get_raw():
            ret[i[self.get_key()]] = {}
            for key in viewkeys(i):
                value = {
                    "decoration": "DEFAULT",
                    "optional": False,
                    "additional": False,
                    "splittable": False,
                }
                ret[i[self.get_key()]][key] = value
    elif isinstance(self.get_raw(), dict) and self.get_raw() is not None:
        # Stats are stored in a dict (ex: CPU, LOAD...)
        for key in viewkeys(self.get_raw()):
            value = {
                "decoration": "DEFAULT",
                "optional": False,
                "additional": False,
                "splittable": False,
            }
            ret[key] = value

    self.views = ret

    return self.views