I'm connecting to an FTP site using FTPS (explicit). Connecting and basic commands work just fine, yet when I try to retrieve a directory listing or a file I get an SSLEOFError.
from ftplib import FTP_TLS
ftps = FTP_TLS()
ftps.auth()
ftps.prot_p()
ftps.login(username, password)
ftps.cwd('/')
ftps.retrlines('LIST')
ftps.quit()
Everything up to the 'LIST' command executes without problems. For the 'LIST' command I get the reply:
'150 Opening data channel for directory listing of "/"
And then I get the error:
SSLEOFError: EOF occurred in violation of protocol (_ssl.c:645)
I've tried setting TLSv1 explicitly - to no avail. Using an FTP client I can connect to the FTP site without problems. What am I doing wrong in my code? I've tried both Python 3.5 and 2.7.