Socket - gaierror

half.italian at gmail.com half.italian at gmail.com
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/program.py", line 123, in notify
    smtp = smtplib.SMTP("theHost")

  File "/usr/lib/python2.4/smtplib.py", 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?

~Sean




More information about the Python-list mailing list