[Python-Dev] test_mimetools failure when hostname unknown.

Anthony Baxter anthony at ekit-inc.com
Fri Nov 28 23:25:18 EST 2003


If you have a machine who's local hostname is just something you've
set, and there's no matching entry in /etc/hosts, test_mimetools fails
with 
test test_mimetools failed -- Traceback (most recent call last):
  File "/home/anthony/src/py/23maint/Lib/test/test_mimetools.py", line 30, in test_boundary
    nb = mimetools.choose_boundary()
  File "/home/anthony/src/py/23maint/Lib/mimetools.py", line 130, in choose_boundary
    hostid = socket.gethostbyname(socket.gethostname())
gaierror: (-2, 'Name or service not known')

This seems, to me, to be a bit bogus - should we just, in this case,
have some sensible default (maybe just use the hostname, or 127.0.0.1)

And yes, I know this is not strictly a python bug, but it just popped 
up while I was building a new system up.

Anthony



More information about the Python-Dev mailing list