diff options
author | Georg Brandl <georg@python.org> | 2006-03-31 17:18:06 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-31 17:18:06 (GMT) |
commit | dd2245f2309da358b4c0b56d6a3a411888052f26 (patch) | |
tree | cc2b848af738f6b48fe997d09aebdc2f30902523 /Lib/mimetools.py | |
parent | 296aef8ebb4701a6fe3af652a230b1107ae5f44a (diff) | |
download | cpython-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.py | 5 |
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: |