2

What i'm making wrong in this dead simple connect/list example? ( i'm using python 3.3 )

import ftplib


ftp = ftplib.FTP_TLS()
ftp.connect('localhost', 221, 20)
ftp.login()
ftp.prot_p()
ftp.retrlines('LIST')

Source : https://docs.python.org/2/library/ftplib.html#ftplib.FTP_TLS

Error output:

Traceback (most recent call last):
  File "C:/projects/nipples/ftps_client.py", line 10, in <module>
    ftp.login()
  File "C:\Python33\lib\ftplib.py", line 703, in login
    self.auth()
  File "C:\Python33\lib\ftplib.py", line 719, in auth
    ssl_version=self.ssl_version)
  File "C:\Python33\lib\ssl.py", line 630, in wrap_socket
    ciphers=ciphers)
  File "C:\Python33\lib\ssl.py", line 350, in __init__
    raise x
  File "C:\Python33\lib\ssl.py", line 346, in __init__
    self.do_handshake()
  File "C:\Python33\lib\ssl.py", line 553, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:548)

Thanks in advance.

MultiVAC
  • 354
  • 1
  • 10
thclpr
  • 5,778
  • 10
  • 54
  • 87
  • Just a guess, I think you have to specify the certificate and the private key. However the docs says it is optional. https://docs.python.org/2/library/ftplib.html#ftplib.FTP_TLS – ρss Jun 05 '14 at 19:51
  • @pss weird... it works properly on python 2.7 without specifying the cert/key – thclpr Jun 06 '14 at 10:45
  • Maybe this helps: http://stackoverflow.com/questions/17916285/ssl-version-in-httplib2-eof-occurred-in-violation-of-protocol – ρss Jun 06 '14 at 11:59
  • @Thales Did you find a solution? – Daniel Kleinstein Oct 07 '15 at 11:52
  • @DanielKleinstein not at all, i had to keep the ftp handler on python2.7 to keep this working :\ – thclpr Oct 08 '15 at 23:28

0 Answers0