On 02/10/15 23:57, Nym City via Tutor wrote:

socket.gaierror: [Errno 11004] getaddrinfo failed
...
for name in ListOfHostNames:
     try:
         ResolveHostname = socket.gethostbyname(name)
         print(ResolveHostname)
         newFile.write(ResolveHostname + "\n")
         print(ResolveHostname)
     except socket.herror as e:
         newFile.write("No resolution available for %s" % (name) + "\n")

You are catching herror but your code is resulting in gaierror.

Add socket.gaierror to your except line.

    except (socket.herror, socket.gaierror):
        newFile.write("No resolution available for %s" % (name) + "\n")

see if that works

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to