WOW. I'm gobsmacked... On Feb 24, 6:13 pm, Tony Nelson <[EMAIL PROTECTED]> wrote: > > Try it from the python command line. This is what happens when I try it
Okay, that was interesting... Apparently there's a subtlety of /etc/hosts that affects this! Originally it had this line: 127.0.0.1 localhost localhost.localdomain foobar and I get this result for my machine ("foobar.foodomain.com"): >>> >>> import socket >>> socket.gethostname() 'foobar.foodomain.com' >>> socket.gethostbyname(_) Traceback (most recent call last): File "<stdin>", line 1, in <module> socket.gaierror: (-2, 'Name or service not known') >>> >>> >>> socket.gethostbyname('localhost') '127.0.0.1' >>> socket.gethostbyname('localhost.localdomain') '127.0.0.1' >>> Whe I change /etc/hosts to this: 127.0.0.1 foobar foobar.foodomain.net localhost.localdomain localhost Python is happy and I get; >>> >>> import socket >>> socket.gethostname() 'foobar.foodomain.net' >>> socket.gethostbyname(_) '127.0.0.1' >>> So, problem "fixed" although I have no real understanding of what was wrong or what's right now. Only that "gethostbyname()" seems to be really sensitive to the format of the /etc/hosts file. Thank you, Tony Nelson. -Bob Montante, -bob,mon. -- http://mail.python.org/mailman/listinfo/python-list