[Python] Python connecting to FTPS server filezilla violation of protocol error

Discussão em 'Python' iniciado por Stack, Julho 31, 2025.

  1. Stack

    Stack Membro Participativo

    Question I want to be able to connect to and download a file from my remote FTP filezilla. I am able to connect however as soon as it executes "ftp.retrlines('LIST')" I get an error as described below. Any help would be greatly appreciated!!!

    Here is my script

    from ftplib import FTP_TLS

    ftp = FTP_TLS('111.111.111.111) # Hidden IP for my FTP SERVER
    ftp.login('ftpuser', 'ftppassword12345')
    ftp.prot_p() # securing data connection explicitly
    ftp.cwd('/') # change working directory to the root

    ftp.retrlines('LIST') # This is where it fails


    Here is the error

    Traceback (most recent call last):
    File "ftps_.py", line 7, in <module>
    ftp.retrlines('LIST')
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ftplib.py", line 735, in retrlines
    conn = self.transfercmd(cmd)
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ftplib.py", line 376, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ftplib.py", line 713, in ntransfercmd
    server_hostname=self.host)
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
    ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:590)

    Continue reading...

Compartilhe esta Página