# Buggy code
def __init__(self, args=None, config=None):
    """Init the plugin."""
    super(Plugin, self).__init__(args=args, config=config, stats_init_value=[])

    # We want to display the stat in the curse interface
    self.display_curse = True

    # Trying to display proc time
    self.tag_proc_time = True

    # Call CorePlugin to get the core number (needed when not in IRIX mode / Solaris mode)
    try:
        self.nb_log_core = CorePlugin(args=self.args).update()["log"]
    except Exception:
        self.nb_log_core = 0

    # Get the max values (dict)
    self.max_values = copy.deepcopy(glances_processes.max_values())

    # Get the maximum PID number
    # Use to optimize space (see https://github.com/nicolargo/glances/issues/959)
    self.pid_max = glances_processes.pid_max

    # Set the default sort key if it is defined in the configuration file
    if (
        "processlist" in config.as_dict()
        and "sort_key" in config.as_dict()["processlist"]
    ):
        logger.debug(
            "Configuration overwrites processes sort key by {}".format(
                config.as_dict()["processlist"]["sort_key"]
            )
        )
        glances_processes.set_sort_key(
            config.as_dict()["processlist"]["sort_key"], False
        )


# Traceback (AttributeError)
$ glances -c localhost
Traceback (most recent call last):
File "/usr/bin/glances", line 11, in <module>
load_entry_point('Glances==3.1.3', 'console_scripts', 'glances')()
File "/usr/lib/python3.8/site-packages/glances/__init__.py", line 143, in main
start(config=config, args=args)
File "/usr/lib/python3.8/site-packages/glances/__init__.py", line 112, in start
mode.serve_forever()
File "/usr/lib/python3.8/site-packages/glances/client.py", line 238, in serve_forever
if not self.login():
File "/usr/lib/python3.8/site-packages/glances/client.py", line 162, in login
if not self._login_glances():
File "/usr/lib/python3.8/site-packages/glances/client.py", line 130, in _login_glances
self.stats.set_plugins(json.loads(self.client.getAllPlugins()))
File "/usr/lib/python3.8/site-packages/glances/stats_client.py", line 59, in set_plugins
self._plugins[item] = plugin.Plugin(args=self.args)
File "/usr/lib/python3.8/site-packages/glances/plugins/glances_connections.py", line 60, in __init__
super(Plugin, self).__init__(args=args,
File "/usr/lib/python3.8/site-packages/glances/plugins/glances_plugin.py", line 90, in __init__
config.config_file_paths()))
AttributeError: 'NoneType' object has no attribute 'config_file_paths'

# Fixed code
def __init__(self, args=None, config=None):
    """Init the plugin."""
    super(Plugin, self).__init__(args=args, config=config, stats_init_value=[])

    # We want to display the stat in the curse interface
    self.display_curse = True

    # Trying to display proc time
    self.tag_proc_time = True

    # Call CorePlugin to get the core number (needed when not in IRIX mode / Solaris mode)
    try:
        self.nb_log_core = CorePlugin(args=self.args).update()["log"]
    except Exception:
        self.nb_log_core = 0

    # Get the max values (dict)
    self.max_values = copy.deepcopy(glances_processes.max_values())

    # Get the maximum PID number
    # Use to optimize space (see https://github.com/nicolargo/glances/issues/959)
    self.pid_max = glances_processes.pid_max

    # Set the default sort key if it is defined in the configuration file
    if config is not None:
        if (
            "processlist" in config.as_dict()
            and "sort_key" in config.as_dict()["processlist"]
        ):
            logger.debug(
                "Configuration overwrites processes sort key by {}".format(
                    config.as_dict()["processlist"]["sort_key"]
                )
            )
            glances_processes.set_sort_key(
                config.as_dict()["processlist"]["sort_key"], False
            )