aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2015-09-29 04:17:33 -0400
committerThierry Vignaud <thierry.vignaud@gmail.com>2015-09-29 04:18:56 -0400
commit2664452360c58e3b4b26de17627c7c5abfbd90ce (patch)
treeb53389396fed54825803cccf87b028736c45b422
parentc1eb9f916c1ea46132b2bca6c1456e0329419b58 (diff)
downloadnet_monitor-2664452360c58e3b4b26de17627c7c5abfbd90ce.tar
net_monitor-2664452360c58e3b4b26de17627c7c5abfbd90ce.tar.gz
net_monitor-2664452360c58e3b4b26de17627c7c5abfbd90ce.tar.bz2
net_monitor-2664452360c58e3b4b26de17627c7c5abfbd90ce.tar.xz
net_monitor-2664452360c58e3b4b26de17627c7c5abfbd90ce.zip
fix "argument for 's' must be a bytes object"
IP adress was no more fetched since switching to python3
-rw-r--r--src/monitor.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/monitor.py b/src/monitor.py
index 87bf2b5..78d6b4b 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -188,13 +188,13 @@ class Monitor:
mac=_("No physical address")
# ip address
try:
- res = self.ioctl(0x8915, struct.pack('256s', ifname[:15]))[20:24]
+ res = self.ioctl(0x8915, struct.pack('256s',bytes(ifname[:15], 'utf-8')))[20:24]
addr=socket.inet_ntoa(res)
except:
addr=_("No address assigned")
# mac address
try:
- mac_struct=self.ioctl(0x8927, struct.pack('256s', ifname[:15]))[18:24]
+ mac_struct=self.ioctl(0x8927, struct.pack('256s', bytes(ifname[:15], 'utf-8')))[18:24]
mac=":".join(["%02x" % ord(char) for char in mac_struct])
except:
addr=_("No address assigned")