Bug #1250170, Patch #1462230: handle socket.gethostname()

failures gracefully
This commit is contained in:
Georg Brandl 2006-03-31 17:18:06 +00:00
parent 296aef8ebb
commit dd2245f230
3 changed files with 17 additions and 5 deletions

View file

@ -127,7 +127,10 @@ def choose_boundary():
import time
if _prefix is None:
import socket
hostid = socket.gethostbyname(socket.gethostname())
try:
hostid = socket.gethostbyname(socket.gethostname())
except socket.gaierror:
hostid = '127.0.0.1'
try:
uid = repr(os.getuid())
except AttributeError: