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 = [] addresses = []
for interface in netifaces.interfaces(): for interface in netifaces.interfaces():
iface_data = netifaces.ifaddresses(interface) try:
for family in iface_data: iface_data = netifaces.ifaddresses(interface)
if family not in (netifaces.AF_INET, netifaces.AF_INET6): for family in iface_data:
continue if family not in (netifaces.AF_INET, netifaces.AF_INET6):
for address in iface_data[family]: continue
addresses.append(address['addr']) for address in iface_data[family]:
addresses.append(address['addr'])
except ValueError:
pass
return addresses return addresses