I am trying to download files using python's ftplib and I am running in an issue. When I run the script on my computer I am getting an error:
Traceback (most recent call last):
File "ftp_get.py", line 20, in <module>
ftps.retrbinary('RETR '+ filename, file.write)
File "C:\Python27\lib\ftplib.py", line 710, in retrbinary
conn.unwrap()
File "C:\Python27\lib\ssl.py", line 771, in unwrap
s = self._sslobj.shutdown()
socket.error: [Errno 0] Error
But when I run it on a server, it works flawlessly. It also worked on my computer earlier this morning but now I get the error. Python code below:
from ftplib import FTP_TLS
import os
import glob
user = "something"
passwd = "some_password"
ftps = FTP_TLS('domain')
ftps.login(user, passwd)
ftps.prot_p()
filenames = ftps.nlst()
for filename in filenames:
local_filename = os.path.join('C:\\test2\\', filename)
file = open(local_filename, 'wb')
ftps.retrbinary('RETR '+ filename, file.write)
print "Downloading - " + filename
#ftps.delete (filename)
#print "Deleting - " + filename
file.close()
ftps.quit()
Why does it work on some computers and not others?