Hello,
I downloaded python CVS tree, compiled it and ran tests.
Two tests failed: urllib2 and mimetools. Both in the same fashion,
when doing socket.gethostbyname(socket.gethostname())
(It is used in mimetools.py library in line 130 and in test_urllib2.py
test unit in line 352.)
In the interpreter it fails in the following way:
>>> import socket
>>> socket.gethostbyname(socket.gethostname())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
socket.gaierror: (-2, 'Name or service not known')
The reason is that my hostname is bogus, no single DNS knows
about it, and I don't see any reason to set up a DNS server on my
box. Of course editing /etc/hosts and adding my hostname as an
alias for 127.0.0.1 solves the problem.
Anyway I don't see any particular reason why the library shouldn't
handle such situation i.e. when there's no connection between
hostname and IP address.
What do you think about it? I can make a SF patch item to solve
this issue if you like. I am quite sure adding try/catch will make it
in both cases.
|