Here is my code:
import socket
import csv
with open('afile.csv','r') as csv:
a_csv = csv.reader(csv)
next(a_csv)
csvList = list(a_csv)
count = 0
for 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 the interpreter: socket.gaierror: [Errno 11001] getaddrinfo failed
The purpose of this little python script is to loop through a list that was generated form a csv file, extract the hostname and lookup the IP address. Once it's done with that it should add it back into the list right after the original hostname (I have an open "space" within the csv for this). So my question is what maybe causing this error to occur?