Telnet function in Python

31 Views Asked by At

I am trying to telnet a device while getting IP address from a file but getting the attached error. I am attaching code from both files as images.myswitches.pytest.py

    root@UbuntuDockerGuest-1:~# ./Test.py
    Enter your Telnet Username: david
    Password: 
    Configuring Switch 192.168.122.71

    Traceback (most recent call last):
      File "./Test.py", line 15, in <module>
        tn = telnetlib.Telnet(HOST)
      File "/usr/lib/python2.7/telnetlib.py", line 211, in __init__
        self.open(host, port, timeout)
      File "/usr/lib/python2.7/telnetlib.py", line 227, in open
        self.sock = socket.create_connection((host, port), timeout)
      File "/usr/lib/python2.7/socket.py", line 557, in create_connection
        for res in getaddrinfo(host, port, 0, SOCK_STREAM):
    socket.gaierror: [Errno -2] Name or service not known
0

There are 0 best solutions below