Socket - gaierror

half.italian at half.italian at
Mon Aug 27 21:24:31 CEST 2007

Hi all,

I'm having trouble with the socket module resolving a hostname.  It
seems like this is a system level problem, but I'm not even sure where
to start.  I can ping the smtp server by name and IP, but when
smtp.SMTP("theHost") tries to get the hostname, it keeps giving me the
following error:

  File "bin/", line 123, in notify
    smtp = smtplib.SMTP("theHost")

  File "/usr/lib/python2.4/", line 255, in __init__
    addr = socket.gethostbyname(socket.gethostname())

gaierror: (-2, 'Name or service not known')

I tried changing to a different smtp server, using an ip instead of a
host name.  I could ping both boxes by name oor IP.

any ideas?


More information about the Python-list mailing list