mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ignore errros when getting ips for network interfaces
This commit is contained in:
parent
6be236729f
commit
849bf30e6e
@ -16,8 +16,14 @@ def get_all_ips():
|
|||||||
all_ips = defaultdict(list)
|
all_ips = defaultdict(list)
|
||||||
if hasattr(netifaces, 'AF_INET'):
|
if hasattr(netifaces, 'AF_INET'):
|
||||||
for x in netifaces.interfaces():
|
for x in netifaces.interfaces():
|
||||||
for c in netifaces.ifaddresses(x).get(netifaces.AF_INET, []):
|
try:
|
||||||
all_ips[x].append(c)
|
for c in netifaces.ifaddresses(x).get(netifaces.AF_INET, []):
|
||||||
|
all_ips[x].append(c)
|
||||||
|
except ValueError:
|
||||||
|
from calibre import prints
|
||||||
|
prints('Failed to get IP addresses for interface', x)
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
return dict(all_ips)
|
return dict(all_ips)
|
||||||
|
|
||||||
def _get_external_ip():
|
def _get_external_ip():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user