# Buggy code
def update(self):
    """Update the FS stats using the input method."""
    # Reset the list
    self.reset()

    if self.input_method == "local":
        # Update stats using the standard system lib

        # Grab the stats using the PsUtil disk_partitions
        # If 'all'=False return physical devices only (e.g. hard disks, cd-rom drives, USB keys)
        # and ignore all others (e.g. memory partitions such as /dev/shm)
        try:
            fs_stat = psutil.disk_partitions(all=False)
        except UnicodeDecodeError:
            return self.stats

        # Optionnal hack to allow logicals mounts points (issue #448)
        # Ex: Had to put 'allow=zfs' in the [fs] section of the conf file
        #     to allow zfs monitoring
        for fstype in self.get_conf_value("allow"):
            try:
                fs_stat += [
                    f
                    for f in psutil.disk_partitions(all=True)
                    if f.fstype.find(fstype) >= 0
                ]
            except UnicodeDecodeError:
                return self.stats

        # Loop over fs
        for fs in fs_stat:
            # Do not take hidden file system into account
            if self.is_hide(fs.mountpoint):
                continue
            # Grab the disk usage
            try:
                fs_usage = psutil.disk_usage(fs.mountpoint)
            except OSError:
                # Correct issue #346
                # Disk is ejected during the command
                continue
            fs_current = {
                "device_name": fs.device,
                "fs_type": fs.fstype,
                # Manage non breaking space (see issue #1065)
                "mnt_point": fs.mountpoint.replace("\u00a0", " "),
                "size": fs_usage.total,
                "used": fs_usage.used,
                "free": fs_usage.free,
                "percent": fs_usage.percent,
                "key": self.get_key(),
            }
            self.stats.append(fs_current)

    elif self.input_method == "snmp":
        # Update stats using SNMP

        # SNMP bulk command to get all file system in one shot
        try:
            fs_stat = self.get_stats_snmp(
                snmp_oid=snmp_oid[self.short_system_name], bulk=True
            )
        except KeyError:
            fs_stat = self.get_stats_snmp(snmp_oid=snmp_oid["default"], bulk=True)

        # Loop over fs
        if self.short_system_name in ("windows", "esxi"):
            # Windows or ESXi tips
            for fs in fs_stat:
                # Memory stats are grabbed in the same OID table (ignore it)
                if (
                    fs == "Virtual Memory"
                    or fs == "Physical Memory"
                    or fs == "Real Memory"
                ):
                    continue
                size = int(fs_stat[fs]["size"]) * int(fs_stat[fs]["alloc_unit"])
                used = int(fs_stat[fs]["used"]) * int(fs_stat[fs]["alloc_unit"])
                percent = float(used * 100 / size)
                fs_current = {
                    "device_name": "",
                    "mnt_point": fs.partition(" ")[0],
                    "size": size,
                    "used": used,
                    "percent": percent,
                    "key": self.get_key(),
                }
                self.stats.append(fs_current)
        else:
            # Default behavior
            for fs in fs_stat:
                fs_current = {
                    "device_name": fs_stat[fs]["device_name"],
                    "mnt_point": fs,
                    "size": int(fs_stat[fs]["size"]) * 1024,
                    "used": int(fs_stat[fs]["used"]) * 1024,
                    "percent": float(fs_stat[fs]["percent"]),
                    "key": self.get_key(),
                }
                self.stats.append(fs_current)

    return self.stats


# Traceback (UnicodeDecodeError)
Traceback (most recent call last):
File "/usr/bin/glances", line 11, in <module>
load_entry_point('Glances==2.10', 'console_scripts', 'glances')()
File "/usr/lib/python2.7/site-packages/glances/__init__.py", line 134, in main
start(config=config, args=args)
File "/usr/lib/python2.7/site-packages/glances/__init__.py", line 100, in start
mode = GlancesMode(config=config, args=args)
File "/usr/lib/python2.7/site-packages/glances/standalone.py", line 69, in __init__
self.stats.update()
File "/usr/lib/python2.7/site-packages/glances/stats.py", line 192, in update
self._plugins[p].update()
File "/usr/lib/python2.7/site-packages/glances/plugins/glances_plugin.py", line 882, in wrapper
ret = fct(self, *args, **kw)
File "/usr/lib/python2.7/site-packages/glances/plugins/glances_plugin.py", line 891, in wrapper
ret = fct(*args, **kw)
File "/usr/lib/python2.7/site-packages/glances/plugins/glances_fs.py", line 135, in update
'mnt_point': fs.mountpoint.replace(u'\u00A0', ' '),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 18: ordinal not in range(128)

# Fixed code
def update(self):
    """Update the FS stats using the input method."""
    # Reset the list
    self.reset()

    if self.input_method == "local":
        # Update stats using the standard system lib

        # Grab the stats using the PsUtil disk_partitions
        # If 'all'=False return physical devices only (e.g. hard disks, cd-rom drives, USB keys)
        # and ignore all others (e.g. memory partitions such as /dev/shm)
        try:
            fs_stat = psutil.disk_partitions(all=False)
        except UnicodeDecodeError:
            return self.stats

        # Optionnal hack to allow logicals mounts points (issue #448)
        # Ex: Had to put 'allow=zfs' in the [fs] section of the conf file
        #     to allow zfs monitoring
        for fstype in self.get_conf_value("allow"):
            try:
                fs_stat += [
                    f
                    for f in psutil.disk_partitions(all=True)
                    if f.fstype.find(fstype) >= 0
                ]
            except UnicodeDecodeError:
                return self.stats

        # Loop over fs
        for fs in fs_stat:
            # Do not take hidden file system into account
            if self.is_hide(fs.mountpoint):
                continue
            # Grab the disk usage
            try:
                fs_usage = psutil.disk_usage(fs.mountpoint)
            except OSError:
                # Correct issue #346
                # Disk is ejected during the command
                continue
            fs_current = {
                "device_name": fs.device,
                "fs_type": fs.fstype,
                # Manage non breaking space (see issue #1065)
                "mnt_point": u(fs.mountpoint).replace("\u00a0", " "),
                "size": fs_usage.total,
                "used": fs_usage.used,
                "free": fs_usage.free,
                "percent": fs_usage.percent,
                "key": self.get_key(),
            }
            self.stats.append(fs_current)

    elif self.input_method == "snmp":
        # Update stats using SNMP

        # SNMP bulk command to get all file system in one shot
        try:
            fs_stat = self.get_stats_snmp(
                snmp_oid=snmp_oid[self.short_system_name], bulk=True
            )
        except KeyError:
            fs_stat = self.get_stats_snmp(snmp_oid=snmp_oid["default"], bulk=True)

        # Loop over fs
        if self.short_system_name in ("windows", "esxi"):
            # Windows or ESXi tips
            for fs in fs_stat:
                # Memory stats are grabbed in the same OID table (ignore it)
                if (
                    fs == "Virtual Memory"
                    or fs == "Physical Memory"
                    or fs == "Real Memory"
                ):
                    continue
                size = int(fs_stat[fs]["size"]) * int(fs_stat[fs]["alloc_unit"])
                used = int(fs_stat[fs]["used"]) * int(fs_stat[fs]["alloc_unit"])
                percent = float(used * 100 / size)
                fs_current = {
                    "device_name": "",
                    "mnt_point": fs.partition(" ")[0],
                    "size": size,
                    "used": used,
                    "percent": percent,
                    "key": self.get_key(),
                }
                self.stats.append(fs_current)
        else:
            # Default behavior
            for fs in fs_stat:
                fs_current = {
                    "device_name": fs_stat[fs]["device_name"],
                    "mnt_point": fs,
                    "size": int(fs_stat[fs]["size"]) * 1024,
                    "used": int(fs_stat[fs]["used"]) * 1024,
                    "percent": float(fs_stat[fs]["percent"]),
                    "key": self.get_key(),
                }
                self.stats.append(fs_current)

    return self.stats