# Buggy code
def msg_curse(self, args=None, max_width=None):
    """Return the dict to display in the curse interface."""
    # Init the return message
    ret = []

    # Only process if stats exist...
    if not self.stats or self.is_disable():
        return ret

    # Max size for the interface name
    name_max_width = max_width - 6

    # Header
    msg = "{:{width}}".format("SMART disks", width=name_max_width)
    ret.append(self.curse_add_line(msg, "TITLE"))
    # Data
    for device_stat in self.stats:
        # New line
        ret.append(self.curse_new_line())
        msg = "{:{width}}".format(
            device_stat["DeviceName"][:max_width], width=max_width
        )
        ret.append(self.curse_add_line(msg))
        for smart_stat in sorted(
            [i for i in device_stat.keys() if i != "DeviceName"], key=int
        ):
            ret.append(self.curse_new_line())
            msg = " {:{width}}".format(
                device_stat[smart_stat]["name"][: name_max_width - 1].replace("_", " "),
                width=name_max_width - 1,
            )
            ret.append(self.curse_add_line(msg))
            msg = "{:>8}".format(device_stat[smart_stat]["raw"])
            ret.append(self.curse_add_line(msg))

    return ret


# Traceback (TypeError)
root@malachor:~# glances
Traceback (most recent call last):
File "/usr/local/bin/glances", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/glances/__init__.py", line 145, in main
start(config=config, args=args)
File "/usr/local/lib/python3.8/dist-packages/glances/__init__.py", line 110, in start
mode = GlancesMode(config=config, args=args)
File "/usr/local/lib/python3.8/dist-packages/glances/standalone.py", line 78, in __init__
self.stats.update()
File "/usr/local/lib/python3.8/dist-packages/glances/stats.py", line 234, in update
self._plugins[p].update()
File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_plugin.py", line 993, in wrapper
ret = fct(self, *args, **kw)
File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_plugin.py", line 1003, in wrapper
ret = fct(*args, **kw)
File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_smart.py", line 155, in update
stats = get_smart_data()
File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_smart.py", line 98, in get_smart_data
devlist = DeviceList()
File "/usr/local/lib/python3.8/dist-packages/pySMART/device_list.py", line 56, in __init__
self._initialize()
File "/usr/local/lib/python3.8/dist-packages/pySMART/device_list.py", line 95, in _initialize
cmd = Popen([SMARTCTL_PATH, '--scan-open'], stdout=PIPE, stderr=PIPE)
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1583, in _execute_child
and os.path.dirname(executable)
File "/usr/lib/python3.8/posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

# Fixed code
def msg_curse(self, args=None, max_width=None):
    """Return the dict to display in the curse interface."""
    # Init the return message
    ret = []

    # Only process if stats exist...
    if import_error_tag or not self.stats or self.is_disable():
        return ret

    # Max size for the interface name
    name_max_width = max_width - 6

    # Header
    msg = "{:{width}}".format("SMART disks", width=name_max_width)
    ret.append(self.curse_add_line(msg, "TITLE"))
    # Data
    for device_stat in self.stats:
        # New line
        ret.append(self.curse_new_line())
        msg = "{:{width}}".format(
            device_stat["DeviceName"][:max_width], width=max_width
        )
        ret.append(self.curse_add_line(msg))
        for smart_stat in sorted(
            [i for i in device_stat.keys() if i != "DeviceName"], key=int
        ):
            ret.append(self.curse_new_line())
            msg = " {:{width}}".format(
                device_stat[smart_stat]["name"][: name_max_width - 1].replace("_", " "),
                width=name_max_width - 1,
            )
            ret.append(self.curse_add_line(msg))
            msg = "{:>8}".format(device_stat[smart_stat]["raw"])
            ret.append(self.curse_add_line(msg))

    return ret