This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients ronaldoussoren
Date 2012-06-22.09:34:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340357685.54.0.913486027358.issue15134@psf.upfronthosting.co.za>
In-reply-to
Content
I just noticed that test_urllib fails for me because urllib.request.thishost() fails:


======================================================================
ERROR: test_thishost (test.test_urllib.Utility_Tests)
Test the urllib.request.thishost utility function returns a tuple
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ronald/Projects/python/rw/default/Lib/test/test_urllib.py", line 1155, in test_thishost
    self.assertIsInstance(urllib.request.thishost(), tuple)
  File "/Users/ronald/Projects/python/rw/default/Lib/urllib/request.py", line 2236, in thishost
    _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

----------------------------------------------------------------------


This is because this host's hostname (Gondolin.local) is not in DNS because my mDNSReponder detected a conflict and picked a different name to advertise in the .local zone without updating the hostname.

The reason I report this anyway is that URLopener.open_local_file seems to assume that thishost() cannot fail, and the error condition on my machine could easily happen on other systems as well.

BTW. The use of this host() in URLopener.open_local_file is wrong for other reasons as well: it assumes that the local machine has exactly 1 IP address, and won't correctly detect that a file is local when the IP address is one of the other IP addresses on a multi homed system.
History
Date User Action Args
2012-06-22 09:34:45ronaldoussorensetrecipients: + ronaldoussoren
2012-06-22 09:34:45ronaldoussorensetmessageid: <1340357685.54.0.913486027358.issue15134@psf.upfronthosting.co.za>
2012-06-22 09:34:44ronaldoussorenlinkissue15134 messages
2012-06-22 09:34:43ronaldoussorencreate