summaryrefslogtreecommitdiffstats
path: root/Lib/mimetools.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-03-31 17:18:06 (GMT)
committerGeorg Brandl <georg@python.org>2006-03-31 17:18:06 (GMT)
commitdd2245f2309da358b4c0b56d6a3a411888052f26 (patch)
treecc2b848af738f6b48fe997d09aebdc2f30902523 /Lib/mimetools.py
parent296aef8ebb4701a6fe3af652a230b1107ae5f44a (diff)
downloadcpython-dd2245f2309da358b4c0b56d6a3a411888052f26.zip
cpython-dd2245f2309da358b4c0b56d6a3a411888052f26.tar.gz
cpython-dd2245f2309da358b4c0b56d6a3a411888052f26.tar.bz2
Bug #1250170, Patch #1462230: handle socket.gethostname()
failures gracefully
Diffstat (limited to 'Lib/mimetools.py')
-rw-r--r--Lib/mimetools.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/mimetools.py b/Lib/mimetools.py
index 0b698ac..8c1cc19 100644
--- a/Lib/mimetools.py
+++ b/Lib/mimetools.py
@@ -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: