Updated whataremyips -> added try/catch block to prevent error related to known

netifaces issue:

https://bugs.launchpad.net/ubuntu/+source/netifaces/+bug/753009

Change-Id: I0f4ccdcf6d1655923d39ed44f4eb81203d3e525b
This commit is contained in:
Brent Roskos 2012-01-05 12:32:15 -05:00
parent 0a7f8ca7b1
commit 76afb46d91

View File

@ -566,12 +566,15 @@ def whataremyips():
"""
addresses = []
for interface in netifaces.interfaces():
iface_data = netifaces.ifaddresses(interface)
for family in iface_data:
if family not in (netifaces.AF_INET, netifaces.AF_INET6):
continue
for address in iface_data[family]:
addresses.append(address['addr'])
try:
iface_data = netifaces.ifaddresses(interface)
for family in iface_data:
if family not in (netifaces.AF_INET, netifaces.AF_INET6):
continue
for address in iface_data[family]:
addresses.append(address['addr'])
except ValueError:
pass
return addresses