Start New Discussion within our Software Development Community

I'm writing a script to automatically up load a file from Server A to FTP server B. I'm getting stuck at the connecting part. I can connect with a python script using regular FTP, and have done so, but when trying to implement a SSL connection, I keep getting a timeout. I can't figure out why. Have searched here and stackoverflow. Any ideas welcomed!

I've verified the SSL setup on the receiving server by manually connecting using a Filezilla client

Here's my script:

from ftplib import FTP
from ftplib import FTP_TLS

ftps = FTP_TLS('xxx.xx.xxx.xx')

ftps.auth()

ftps.sendcmd('USER User') 
ftps.sendcmd('PASS Password')

ftps.prot_p()
ftps.retrlines('LIST')

ftps.close()

And the result is:

Traceback (most recent call last):
  File "Script path and name removed for posting", line 12, in <module>
    ftps.retrlines('LIST')
  File "C:\Python33\lib\ftplib.py", line 767, in retrlines
    conn = self.transfercmd(cmd)
  File "C:\Python33\lib\ftplib.py", line 381, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "C:\Python33\lib\ftplib.py", line 742, in ntransfercmd
    conn, size = FTP.ntransfercmd(self, cmd, rest)
  File "C:\Python33\lib\ftplib.py", line 343, in ntransfercmd
    source_address=self.source_address)
  File "C:\Python33\lib\socket.py", line 424, in create_connection
    raise err
  File "C:\Python33\lib\socket.py", line 415, in create_connection
    sock.connect(sa)
    TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

What am I doing wrong, or not doing?

I think I solved the problem by inserting " ftps.set_pasv(False) " immediately after the " ftps.prot_p() " statement. That solves the time out problem, but know I have a new problem which I'll ask as a new questio

This question has already been answered. Start a new discussion instead.