changeset: 93531:97ceab0bd6f8 branch: 3.4 parent: 93522:a08c3703f844 user: Serhiy Storchaka date: Fri Nov 21 21:55:39 2014 +0200 files: Lib/uuid.py description: Issue #17293: socket.gethostbyname() can raise an exception of FreeBSD. diff -r a08c3703f844 -r 97ceab0bd6f8 Lib/uuid.py --- a/Lib/uuid.py Fri Nov 21 00:23:27 2014 +0100 +++ b/Lib/uuid.py Fri Nov 21 21:55:39 2014 +0200 @@ -361,7 +361,10 @@ 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', [ip_addr], lambda i: -1)