在Python中连接FTP时出现错误:
server.connect('68.183.91.171')
File "/usr/lib/python3.6/ftplib.py", line 152, in connect
source_address=self.source_address)
File "/usr/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
我的代码:
import ftplib
server = ftplib.FTP()
server.connect('68.183.91.171')
server.login('root','password')
server.dir()
我认为连接设置正确,因为我可以在终端中进行连接: