From 84fd119f26ad16349d55a2f1b69f0f8c8ccd867b Mon Sep 17 00:00:00 2001 From: noisyfox Date: Sat, 7 Jan 2017 19:14:02 +1100 Subject: [PATCH] Fix mujson_mgr.py crash on windows --- mujson_mgr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mujson_mgr.py b/mujson_mgr.py index a40c8fe..ca62a84 100644 --- a/mujson_mgr.py +++ b/mujson_mgr.py @@ -42,7 +42,6 @@ class MuMgr(object): def getipaddr(self, ifname='eth0'): import socket import struct - import fcntl ret = '127.0.0.1' try: ret = socket.gethostbyname(socket.getfqdn(socket.gethostname())) @@ -50,6 +49,7 @@ class MuMgr(object): pass if ret == '127.0.0.1': try: + import fcntl s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ret = socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15]))[20:24]) except: