From 2664452360c58e3b4b26de17627c7c5abfbd90ce Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 29 Sep 2015 04:17:33 -0400 Subject: fix "argument for 's' must be a bytes object" IP adress was no more fetched since switching to python3 --- src/monitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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") -- cgit v1.2.1