I try to resolve hosts using socket module via GUI I made using Tkinter here is part of the code , the main issue is the error I receive while resolving routers name
for line in p.stdout:
fiw = open("1.txt", '+a')
line = str(line)
if "Received = 1" in line:
hostad = socket.gethostbyaddr(ip3 +str(i))
if hostad:
try:
print(hostad)
except socket.herror:
print(hostad)
fiw.write("Received reply from " + ip3 +str(i)+"\n")
print("Received reply from " + ip3 +str(i)+"\n")
print(socket.gethostbyaddr(ip3 +str(i)))
the error :
socket.herror: [Errno 11004] host not found
script won't run further i used print
here just for example also i tried pass
tried
except socket.herror as err:
print(err)
pass
also tried just using pass
in this method