Message350308
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 |
|
Date |
User |
Action |
Args |
2019-08-23 15:38:46 | realnehareddy | set | recipients:
+ realnehareddy, paul.moore, christian.heimes, tim.golden, zach.ware, steve.dower, Matthieu Pepin, corona10, jonathan-lp, Grégoire Chauvet, paulw11 |
2019-08-23 15:38:46 | realnehareddy | set | messageid: <1566574726.74.0.62409983594.issue31727@roundup.psfhosted.org> |
2019-08-23 15:38:46 | realnehareddy | link | issue31727 messages |
2019-08-23 15:38:45 | realnehareddy | create | |
|