sockets - Python Script Fails to Get IP from a List of Hostnames -


here code:

    import socket import csv  open('afile.csv','r') csv:     a_csv = csv.reader(csv)     next(a_csv)     csvlist = list(a_csv) count = 0 row in csvlist:     if count == len(csvlist):         count = len(csvlist)-1     hostname = socket.gethostbyname(csvlist[count][0])     count += 1 

the error i'm getting through interpreter: socket.gaierror: [errno 11001] getaddrinfo failed

the purpose of little python script loop through list generated form csv file, extract hostname , lookup ip address. once it's done should add list right after original hostname (i have open "space" within csv this). question maybe causing error occur?


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -