Socket - gaierror

Douglas Wells see at signature.invalid
Tue Aug 28 01:22:35 CEST 2007


In article <1188244050.029920.314700 at i13g2000prf.googlegroups.com>,
 half.italian at gmail.com writes:
> On Aug 27, 12:32 pm, Larry Bates <larry.ba... at websafe.com> wrote:
> 
> Changing it to IP gives me the same exact error...
> 
>   File "bin/prgram.py", line 123, in notify
>     smtp = smtplib.SMTP("XXX.XXX.XXX.XXX")
> 
>   File "/usr/lib/python2.4/smtplib.py", line 255, in __init__
>     addr = socket.gethostbyname(socket.gethostname())
> 
> gaierror: (-2, 'Name or service not known')
> 
> Looks like the smtp port is closed on the client machine...doh Should
> have gotten to that!
> 
> ~Sean

Note that the lookup is of your *local* system name
(socket.gethostname()).  I suspect that the name of your client
system (the one running the python script) is not registered in
DNS.

Try ping'ing your own system and see if that resolves in DNS.  In
UNIX/Linux you can use the hostname command; in any system you can
write a python script to print the result of socket.gethostname().

 - dmw


-- 
.   Douglas Wells             .  Connection Technologies      .
.   Internet:  -sp9804- -at - contek.com-                     .



More information about the Python-list mailing list