Python Forum
socket.gaierror: [Errno 11001]
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
socket.gaierror: [Errno 11001]
#5
Hi i am still facing the same kind of issue.

Below is my code
import telnetlib
import getpass

p=open("ipadd.txt")

user=input("Please Enter the Username: ")
password=getpass.getpass()


for line in p:
    print("Configuring Switch with IP : "+line)
    HOST=str(line.split())
    tel=telnetlib.Telnet(HOST)

    tel.read_until(b"Username:")
    tel.write(user.encode("ascii")+b"\n")

    if password:
        tel.read_until(b"Password:")
        tel.write(password.encode("ascii")+b"\n")


    tel.write(b"conf t \n")


    for x in range(10,20):
        tel.write(b"vlan "+str(x).encode("ascii")+b"\n")
        tel.write(b"exit \n")
        
    tel.write(b"end \n")
    tel.write(b"wr \n")
    tel.write(b"exit \n")

    print(tel.read_all().decode("ascii"))

p.close()
Here is the output, with error
Error:
Please Enter the Username: cisco Password: Configuring Switch with IP : 10.10.10.50 [error]Traceback (most recent call last): File "c:/Users/Nemat/Python/openswitches.py", line 13, in <module> tel=telnetlib.Telnet(HOST) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\telnetlib.py", line 218, in __init__ self.open(host, port, timeout) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\telnetlib.py", line 234, in open self.sock = socket.create_connection((host, port), timeout) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\socket.py", line 707, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\socket.py", line 748, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11001] getaddrinfo failed
can some one help in this matter
Reply


Messages In This Thread
socket.gaierror: [Errno 11001] - by Johnygo - Aug-06-2019, 06:40 PM
RE: socket.gaierror: [Errno 11001] - by Johnygo - Aug-06-2019, 08:14 PM
RE: socket.gaierror: [Errno 11001] - by DeaD_EyE - Aug-07-2019, 09:09 AM
RE: socket.gaierror: [Errno 11001] - by Johnygo - Aug-07-2019, 02:49 PM
RE: socket.gaierror: [Errno 11001] - by nemat - Nov-03-2019, 08:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  socket.gaierror: [Errno -2] Name or service not known seokangwoo99 5 15,903 May-25-2019, 02:36 PM
Last Post: DeaD_EyE
  socket.gaierror: [Errno -2] Name or Service not known ItsAGuyaneseTing 1 11,677 Mar-02-2018, 07:14 PM
Last Post: mpd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020