From 75aca76aaf7412ef0d4abdddd3fbc5b2a541cfa1 Mon Sep 17 00:00:00 2001 From: Ultrabug Date: Mon, 6 Apr 2015 22:55:15 +0200 Subject: fix sysdata used RAM detection wrt issue #94 reported by @habash1986 --- py3status/modules/sysdata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/py3status/modules/sysdata.py b/py3status/modules/sysdata.py index f836bc1..9343722 100644 --- a/py3status/modules/sysdata.py +++ b/py3status/modules/sysdata.py @@ -24,6 +24,7 @@ class GetData: - `arg`: argument. """ result = subprocess.check_output([cmd, arg]) + result = result.decode('utf-8') return result def cpu(self): @@ -60,8 +61,9 @@ class GetData: """ # Run 'free -m' command and make a list from output. mem_data = self.execCMD('free', '-m').split() - total_mem = int(mem_data[7]) / 1024. - used_mem = int(mem_data[15]) / 1024. + mem_index = mem_data.index('Mem:') + total_mem = int(mem_data[mem_index + 1]) / 1024. + used_mem = int(mem_data[mem_index + 2]) / 1024. # Caculate percentage used_mem_percent = int(used_mem / (total_mem / 100)) -- cgit v1.3