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