Something like this should work:
def net_get_ip(): # by Whise
"""Returns ip if it can"""
ip = commands.getoutput("ip -o -4 addr show")
x = 0
while True:
ip = ip[ip.find("inet "):]
ip = ip[5:]
ipc = ip[:ip.find("/")]
if ipc != '127.0.0.1' and ipc != None and ipc !='1':
return ipc
return _('Cannot get ip')
** Patch added: "patch using ip addr show instead of ifconfig"
https://bugs.launchpad.net/ubuntu/+source/screenlets/+bug/618868/+attachment/1733341/+files/sensors.py.patch
--
sysmonitor screenlet fails to find the computer's IP address
https://bugs.launchpad.net/bugs/618868
You received this bug notification because you are a member of
Screenlets Dev Team, which is subscribed to Screenlets.
_______________________________________________
Mailing list: https://launchpad.net/~screenlets-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~screenlets-dev
More help : https://help.launchpad.net/ListHelp