Such a problem ... When downloading files from an FTP server, some of them are loaded empty (not all). Please tell me what could be the problem?
Here is a piece of code ...
ftp_host = '' ftp_user = '' ftp_password = '' ftp_connect = FTP(ftp_host, ftp_user, ftp_password) ftp_connect.cwd('IN') file_names = ftp_connect.nlst() for filename in file_names: host_file = os.path.join('c:/ftp_test/', filename) try: with open(host_file, 'wb') as local_file: print('Copy... ' + filename) ftp_connect.retrbinary('RETR ' + filename, local_file.write) except ftplib.error_perm: pass