aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-02-10 18:28:14 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-02-10 18:28:14 +0100
commita3018bf0c12a206d290293062f9ad2f673068ce6 (patch)
treef6da1b8b4c40b20893ced9b84a226d345f406b95 /src
parent1479b0109f3cad7d0ff1687e49ba142734c42fbc (diff)
downloadnet_monitor-a3018bf0c12a206d290293062f9ad2f673068ce6.tar
net_monitor-a3018bf0c12a206d290293062f9ad2f673068ce6.tar.gz
net_monitor-a3018bf0c12a206d290293062f9ad2f673068ce6.tar.bz2
net_monitor-a3018bf0c12a206d290293062f9ad2f673068ce6.tar.xz
net_monitor-a3018bf0c12a206d290293062f9ad2f673068ce6.zip
silent a warning when there's no wireless device
Diffstat (limited to 'src')
-rw-r--r--src/monitor.py3
1 files changed, 3 insertions, 0 deletions
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: