Bugs item #1250170, was opened at 2005-08-02 12:17 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1250170&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Tadeusz Andrzej Kadlubowski (tkadlubo) Assigned to: Nobody/Anonymous (nobody) Summary: gethostbyname(gethostname()) fails on misconfigured system Initial Comment: 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. ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-03-31 17:41 Message: Logged In: YES user_id=849994 Applied patch in rev. 43490. ---------------------------------------------------------------------- Comment By: Kuba KoÅczyk (jakamkon) Date: 2006-03-31 16:42 Message: Logged In: YES user_id=1491175 Patch #1462230 fix it ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2005-09-30 06:33 Message: Logged In: YES user_id=33168 Please provide a patch and attach it to this report. Thanks. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1250170&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com