I have written the code below:
import os, sys
import paramiko
ssh = paramiko.SSHClient()
ssh.connect(server_name, username = ?, password = ?)
I'm trying to connect to an ftp server that doesn't need an account (username and password) to get access. However, when I try some of the following:
ssh.connect(server_name, username = '', password = '')
or
ssh.connect(server_name, username = 'anonymous', password = '')
or
ssh.connect(server_name)
I get this error:
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Could someone please explain why I get this error and how to fix it?
gai stands for getaddrinfo()
, which relates to your server_name
. A common mistake is related to host declaration. If you can give us details about the server_name
may be helpful.
(Sorry for not answering as a comment, but I'm not able to comment).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.