From a3018bf0c12a206d290293062f9ad2f673068ce6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 10 Feb 2014 18:28:14 +0100 Subject: silent a warning when there's no wireless device --- NEWS | 1 + src/monitor.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 7bba823..93c8c40 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ Mandriva network monitoring tool -- History of user-visible changes Copyright (C) 2009, Mandriva - fix missing interface name in message +- silent a warning when there's no wireless device 0.15: - updated translations diff --git a/src/monitor.py b/src/monitor.py index 8d6c909..7cb9192 100644 --- a/src/monitor.py +++ b/src/monitor.py @@ -2,6 +2,7 @@ """net_monitor: wifi monitoring""" import os +import os.path import socket import fcntl import struct @@ -159,6 +160,8 @@ class Monitor: """Check if device is wireless and get its details if necessary""" try: stats = {} + if not os.path.isfile("/proc/net/wireless"): + return stats with open("/proc/net/wireless") as fd: ifaces = fd.readlines()[2:] for line in ifaces: -- cgit v1.2.1