From ebbc25dc3d61dd0b284b4963d0b950c93ba611a3 Mon Sep 17 00:00:00 2001 From: aristocratos Date: Mon, 3 Aug 2020 19:42:09 +0200 Subject: [PATCH] Fixed: net_io_counters() not iterating over itself --- bpytop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpytop.py b/bpytop.py index 2e8c41d..2e6e7bf 100755 --- a/bpytop.py +++ b/bpytop.py @@ -2714,7 +2714,7 @@ class NetCollector(Collector): errlog.exception(f'{e}') if not io_all: return up_stat = psutil.net_if_stats() - for nic in sorted(psutil.net_if_addrs(), key=lambda nic: (getattr(io_all.get(nic), "bytes_recv", 0) + getattr(io_all.get(nic), "bytes_sent", 0)), reverse=True): + for nic in sorted(io_all.keys(), key=lambda nic: (getattr(io_all[nic], "bytes_recv", 0) + getattr(io_all[nic], "bytes_sent", 0)), reverse=True): if nic not in up_stat or not up_stat[nic].isup: continue cls.nics.append(nic)