ftps.storlines socket.timeout despite file upload completing

Solution 1:

I was able to overcome the problem by overwriting

ftplib._SSLSocket = None

Here a more complete example:

def transfer_zip(dest_zipfile, host, host_path, user, password):
    os.chdir(dirname(dest_zipfile))
    with ftplib.FTP_TLS(host, timeout=10) as ftp:
        ftp.login(user, password)
        ftp.prot_p()
        ftp.cwd(host_path)
        ftplib._SSLSocket = None
        ftp.storbinary(f"STOR {basename(dest_zipfile)}", open(dest_zipfile, 'rb'))
        ftp.quit()
        ftp.close()