From a272c6abb5fcf12c3ab93ee507fde68ac0f40c27 Mon Sep 17 00:00:00 2001 From: Foo Date: Sun, 30 Aug 2015 01:21:49 +0300 Subject: [PATCH] Use net_io_counters by default also in _get_interfaces Fixes #1435 --- powerline/segments/common/net.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/powerline/segments/common/net.py b/powerline/segments/common/net.py index 46243c66..0af5762d 100644 --- a/powerline/segments/common/net.py +++ b/powerline/segments/common/net.py @@ -150,7 +150,10 @@ try: return if_io.bytes_recv, if_io.bytes_sent def _get_interfaces(): - io_counters = psutil.network_io_counters(pernic=True) + try: + io_counters = psutil.net_io_counters(pernic=True) + except AttributeError: + io_counters = psutil.network_io_counters(pernic=True) for interface, data in io_counters.items(): if data: yield interface, data.bytes_recv, data.bytes_sent