I am trying to connect to FTP server to transfer a file. Here is my code;
import ftplib
ftp = ftplib.FTP()
host = host_name
port = 22
ftp.connect(host, port)
ftp.login(username, password)
But here is the error I got. Can anybody please help me? I would really appreciate your help.
EOFError Traceback (most recent call last)
<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: