0

First thank you for reading this.

My problem is that I kinda got behind the error by making an infinit loop

"while True" then I try my commands, Navigating, listing ...

I made an excepting to get me past this error 421 but am not satisfied.

Here is what I did :

          except ftplib.error_temp  as e:
                print('Time run out reconnect: ',e)
                RemoteTar.ftp_connect_to_site()

This exception will be printed it still true

so It going to stay stuck in that part of the code

what I did is desprately calling my function from a class this function is what allows me to reconnect

what I want is a better way to stay connected to the ftp server.

Thanks in advance

MTS
  • 33
  • 3
  • 11

1 Answers1

0

This kind of FTP error is generating by server. As usual FTP server drops connection if there are no any downloads/uploads of files.

You may try avoid this error by sending PASV command to FTP server (it helped me when I used FileZilla Server) after each command at server.

ftp.sendcmd('PASV')
Styx
  • 9,863
  • 8
  • 43
  • 53