@@ -176,7 +176,7 @@ def memusage(_proc_pid_stat=None):
176176 """
177177 _proc_pid_stat = _proc_pid_stat or f'/proc/{ os .getpid ()} /stat'
178178 try :
179- with open (_proc_pid_stat ) as f :
179+ with open (_proc_pid_stat , encoding = 'utf-8' ) as f :
180180 l = f .readline ().split (' ' )
181181 return int (l [22 ])
182182 except Exception :
@@ -205,7 +205,7 @@ def jiffies(_proc_pid_stat=None, _load_time=None):
205205 if not _load_time :
206206 _load_time .append (time .time ())
207207 try :
208- with open (_proc_pid_stat ) as f :
208+ with open (_proc_pid_stat , encoding = 'utf-8' ) as f :
209209 l = f .readline ().split (' ' )
210210 return int (l [13 ])
211211 except Exception :
@@ -1483,7 +1483,7 @@ def check_support_sve(__cache=[]):
14831483 import subprocess
14841484 cmd = 'lscpu'
14851485 try :
1486- output = subprocess .run (cmd , capture_output = True , text = True )
1486+ output = subprocess .run (cmd , capture_output = True , text = True , encoding = 'utf-8' )
14871487 result = 'sve' in output .stdout
14881488 except (OSError , subprocess .SubprocessError ):
14891489 result = False
@@ -2760,7 +2760,7 @@ def _get_mem_available():
27602760
27612761 if sys .platform .startswith ('linux' ):
27622762 info = {}
2763- with open ('/proc/meminfo' ) as f :
2763+ with open ('/proc/meminfo' , encoding = 'utf-8' ) as f :
27642764 for line in f :
27652765 p = line .split ()
27662766 info [p [0 ].strip (':' ).lower ()] = int (p [1 ]) * 1024
0 commit comments