socket.gethostbyaddr() problem

Thomas Wouters thomas at xs4all.net
Thu Feb 3 03:19:57 EST 2000


On Wed, Feb 02, 2000 at 05:22:57PM -0600, Jason Abate wrote:
> I'm having a problem with socket.gethostbyaddr().  If I call it as
> root, it works fine, but if I call it as non-root, I get the following
> exception:
> 
>     socket.gethostbyaddr(socket.gethostname())
>     socket.error: host not found
> 
> This is on a fairly standard Redhat 6.0 box.  I've checked to see if
> /etc/hosts is world readable, and nslookup on the machine works fine.
> Any idea what could be causing this problem?  I'm desparate to fix
> and, and welcome any suggestions.

It works fine on my rh6.0 box here:

>>> socket.gethostbyaddr(socket.gethostname())
('tilburg.poiesz.net', [], ['194.109.58.47'])

Did you check /etc/resolv.conf as well? I do get a 'host not found' error
when my /etc/resolv.conf is unreadable and my hostname is not listed in
/etc/hosts. If that doesn't fix it, are you using a DNS, or are you
unconnected and relying entirely on /etc/hosts ? Does it have the proper
entries for your hostname ?

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list