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.sendcmd('USER User') 
ftps.sendcmd('PASS Password')



And the result is:

Traceback (most recent call last):
  File "Script path and name removed for posting", line 12, in <module>
  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
  File "C:\Python33\lib\socket.py", line 424, in create_connection
    raise err
  File "C:\Python33\lib\socket.py", line 415, in create_connection
    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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.