aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Lib/uuid.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 598aea1956a..9c2a971ae52 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -359,7 +359,10 @@ def _ifconfig_getnode():
def _arp_getnode():
"""Get the hardware address on Unix by running arp."""
import os, socket
- ip_addr = socket.gethostbyname(socket.gethostname())
+ try:
+ ip_addr = socket.gethostbyname(socket.gethostname())
+ except OSError:
+ return None
# Try getting the MAC addr from arp based on our IP address (Solaris).
return _find_mac('arp', '-an', [os.fsencode(ip_addr)], lambda i: -1)