[Python] Python paramiko socket.gaierror: [Errno 11001] getaddrinfo failed

Discussão em 'Python' iniciado por Stack, Julho 8, 2025.

  1. Stack

    Stack Membro Participativo

    I have the code below which results in:

    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno 11001] getaddrinfo failed


    The code is:

    import sys
    sys.path.append
    ('C:/Users/xxxxx/source/packages')
    import paramiko
    import sys
    host = "sftp://sftp.xxxxx.com"
    port = 22
    transport = paramiko.Transport((host, port))
    password = "xxxx"
    username = "xxxxx"
    transport.connect(username,password)
    sftp = paramiko.SFTPClient.from_transport(transport)
    filepath = 'C:/Python36'
    localpath = '/'
    sftp.get(filepath, localpath)


    The error line:

    if type(sock) is tuple: # connect to the given (host, port) hostname, port = sock self.hostname = hostname reason = 'No suitable address family' addrinfos = socket.getaddrinfo( hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM


    And the first error message is:

    line 317, in init hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM


    Moreover, I have no idea on which path should I set (I have only sftp, username, password and port and that's enough for Mozilla)

    Continue reading...

Compartilhe esta Página