Expand|Select|Wrap|Line Numbers
- socket.gaierror: [Errno -2] Name or service not known
I searched google for it and found this: https://stackoverflow.com/questions/...vice-not-known, but that doesn't solve the problem, as I can connect like normal to the server using a terminal, only in Python it's not working.
I also found this source: https://www.programcreek.com/python/...ocket.gaierror, but a simple try-except won't help, if the code *always* runs into this error, not just occasionally.
The code I use:
Expand|Select|Wrap|Line Numbers
- import paramiko
- hostname, sshport, username, password = splitLine
- print(splitLine)
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(hostname, port=int(sshport), username=username, password=password)
Expand|Select|Wrap|Line Numbers
- my_server_adress port username password
I also tried the port with and without conversion to an integer, get the same error both times.