Neha Reddy <nre...@toolsgroup.com> added the comment:
We faced the same issue while trying to copy files to an FTPS server. We are trying to connect to a Filezilla server. The type of encryption we are using for the FTPS is 'Require explicit FTP over TLS'. There are the errors that my colleague and I had while trying to use the ftp.nlst() or the storbinary() functions in ftplib. EOF occurred in violation of protocol (_ssl.c:852) OSError: [Errno 0] Error After some research on the internet, we found a workaround on stack overflow (https://stackoverflow.com/questions/46633536/getting-a-oserror-when-trying-to-list-ftp-directories-in-python) Below is the code for the workaround. hoping this could help resolve the issue in the newer version. import ftplib from ssl import SSLSocket class ReusedSslSocket(SSLSocket): def unwrap(self): pass class MyFTP_TLS(ftplib.FTP_TLS): """Explicit FTPS, with shared TLS session""" def ntransfercmd(self, cmd, rest=None): conn, size = ftplib.FTP.ntransfercmd(self, cmd, rest) if self._prot_p: conn = self.context.wrap_socket(conn, server_hostname=self.host, session=self.sock.session) # reuses TLS session conn.__class__ = ReusedSslSocket # we should not close reused ssl socket when file transfers finish return conn, size ---------- nosy: +realnehareddy _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31727> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com