Fix mujson_mgr.py crash on windows
This commit is contained in:
parent
fd9214b334
commit
84fd119f26
1 changed files with 1 additions and 1 deletions
|
@ -42,7 +42,6 @@ class MuMgr(object):
|
||||||
def getipaddr(self, ifname='eth0'):
|
def getipaddr(self, ifname='eth0'):
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
import fcntl
|
|
||||||
ret = '127.0.0.1'
|
ret = '127.0.0.1'
|
||||||
try:
|
try:
|
||||||
ret = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
|
ret = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
|
||||||
|
@ -50,6 +49,7 @@ class MuMgr(object):
|
||||||
pass
|
pass
|
||||||
if ret == '127.0.0.1':
|
if ret == '127.0.0.1':
|
||||||
try:
|
try:
|
||||||
|
import fcntl
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
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])
|
ret = socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15]))[20:24])
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Reference in a new issue