我的代码如下:
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
代码是:
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)
错误行:
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
第一条错误消息是:
line 317, in init hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM
此外,我不知道我应该设置哪条路径(我只有sftp,用户名,密码和端口,这对Mozilla来说已经足够了)