mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-26 02:31:36 +03:00
Correct encoding issue with AMP sustemd and Python 3.5
This commit is contained in:
parent
0ba5b95ff1
commit
32eff4d079
2
NEWS
2
NEWS
@ -15,7 +15,7 @@ Changes:
|
||||
|
||||
Enhancements and new features:
|
||||
|
||||
* WebUI CPU consumption optimization (issue #836)
|
||||
* WebUI CPU consumption optimization (issue #836)
|
||||
* Add ZeroMQ exporter (issue #939)
|
||||
* Add CouchDB exporter (issue #928)
|
||||
* Add hotspot Wifi informations (issue #937)
|
||||
|
@ -48,7 +48,7 @@ systemctl_cmd=/usr/bin/systemctl --plain
|
||||
from subprocess import check_output
|
||||
|
||||
from glances.logger import logger
|
||||
from glances.compat import iteritems
|
||||
from glances.compat import iteritems, to_ascii
|
||||
from glances.amps.glances_amp import GlancesAmp
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ class Amp(GlancesAmp):
|
||||
else:
|
||||
status = {}
|
||||
# For each line
|
||||
for r in res.split('\n')[1:-8]:
|
||||
for r in to_ascii(res).split('\n')[1:-8]:
|
||||
# Split per space .*
|
||||
l = r.split()
|
||||
if len(l) > 3:
|
||||
|
@ -106,6 +106,8 @@ else:
|
||||
def to_ascii(s):
|
||||
"""Convert the unicode 's' to a ASCII string
|
||||
Usefull to remove accent (diacritics)"""
|
||||
if isinstance(s, binary_type):
|
||||
return s
|
||||
return unicodedata.normalize('NFKD', s).encode('ASCII', 'ignore')
|
||||
|
||||
def listitems(d):
|
||||
|
Loading…
Reference in New Issue
Block a user