gpt4 book ai didi

python - 在 Python 中连接到 FTP 服务器时出现 EOFError

转载 作者:行者123 更新时间:2023-11-28 21:42:57 28 4
gpt4 key购买 nike

<分区>

我正在尝试连接到 FTP 服务器以传输文件。这是我的代码;

import ftplib
ftp = ftplib.FTP()
host = host_name
port = 22
ftp.connect(host, port)
ftp.login(username, password)

但这是我得到的错误。有人可以帮我吗?非常感谢您的帮助。


EOFError Traceback(最后一次调用)

<ipython-input-2-094fa8cc7c63> in <module>()
3 host = host_name
4 port = 22
----> 5 ftp.connect(host, port)
6 ftp.login(username, password)

C:\Users\Ishwor.Bhatta\Anaconda3\lib\ftplib.py in connect(self, host, port, timeout, source_address)
154 self.af = self.sock.family
155 self.file = self.sock.makefile('r', encoding=self.encoding)
--> 156 self.welcome = self.getresp()
157 return self.welcome
158

C:\Users\Ishwor.Bhatta\Anaconda3\lib\ftplib.py in getresp(self)
233 # Raise various errors if the response indicates an error
234 def getresp(self):
--> 235 resp = self.getmultiline()
236 if self.debugging:
237 print('*resp*', self.sanitize(resp))

C:\Users\Ishwor.Bhatta\Anaconda3\lib\ftplib.py in getmultiline(self)
223 code = line[:3]
224 while 1:
--> 225 nextline = self.getline()
226 line = line + ('\n' + nextline)
227 if nextline[:3] == code and \

C:\Users\Ishwor.Bhatta\Anaconda3\lib\ftplib.py in getline(self)
207 print('*get*', self.sanitize(line))
208 if not line:
--> 209 raise EOFError
210 if line[-2:] == CRLF:
211 line = line[:-2]

EOFError:

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com