python 3.x - python3 ftplib SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:645)') -
hello trying simple read , write files simple ftp file zilla server using passive mode , explicit tls have setup works fine file zilla client. cannot figure out how resolve error when reading or writing. commands other things mkdir work fine well
>>> ftplib import ftp_tls >>> import subprocess >>> import io >>> import os >>> import sys >>> datetime import datetime, date, time >>> os.path import basename >>> local_filename = os.path.join(os.getcwd(), 'kansascitytestdata.csv') >>> print(local_filename) /var/www/kansascitytestdata.csv >>> myfile = open(local_filename, 'wb') >>> myfile <_io.bufferedwriter name='/var/www/kansascitytestdata.csv'> >>> command = 'retr /%s' % 'kansascitytestdata.csv' >>> command 'retr /kansascitytestdata.csv' >>> ftp = ftp_tls('111.111.111.111') #except real info >>> ftp.login('myuser', 'mypass') '230 logged on' >>> ftp.prot_p() '200 protection level set p' >>> ftp.set_pasv(true) >>> ftp.retrbinary(command, myfile.write) traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python3.5/ftplib.py", line 441, in retrbinary self.transfercmd(cmd, rest) conn: file "/usr/lib/python3.5/ftplib.py", line 398, in transfercmd return self.ntransfercmd(cmd, rest)[0] file "/usr/lib/python3.5/ftplib.py", line 796, in ntransfercmd server_hostname=self.host) file "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket _context=self) file "/usr/lib/python3.5/ssl.py", line 752, in __init__ self.do_handshake() file "/usr/lib/python3.5/ssl.py", line 988, in do_handshake self._sslobj.do_handshake() file "/usr/lib/python3.5/ssl.py", line 633, in do_handshake self._sslobj.do_handshake() ssl.ssleoferror: eof occurred in violation of protocol (_ssl.c:645)
i using python3.5.2 on ubuntu 16.04. have been looking on lots of cimilar questions, non seem apply ftp. can find python3 support explicit tls fine. appreciated.
so figured out , answer not in other thread fine. turns our server had tls session reuse enabled passive connections , wasn't supported until python3.6. turned off requirement , worked fine. in filezilla called "require tls session resumption on data connections when using prot_p".
Comments
Post a Comment