I'm having difficulties with python download manager. I already tried downloading with only wget and it worked. I also created my wxpython interface. But my problem now is how will I combine the two? How am I going to add the wget downloading code to my wxpython interface and make it work? Is it possible to combine wget with python to come up with a download manager, such as winwget or visualwget?
import os
from ftplib import FTP
ftp = FTP("ftpsite","username", "password")
ftp.login()
ftp.retrlines("LIST")
ftp.cwd("folderOne")
ftp.cwd("subFolder")
listing = []
ftp.retrlines("LIST", listing.append)
words = listing[0].split(None, 8)
filename = words[-1].lstrip()
#download the file
local_filename = os.path.join(r"C:\example", file)
lf = open(local_filename, "wb")
ftp.retrbinary("RETR " + filename, lf.write, 8*1024)
lf.close()
I've tried this code it's from your blog. But it says,
Traceback (most recent call last):
File "directory", line 4, in <module>
ftp = FTP("ftp://samoa.gsfc.nasa.gov/site/", "user", "password")
File "C:\Python27\lib\ftplib.py", line 117, in __init__
self.connect(host)
File "C:\Python27\lib\ftplib.py", line 132, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "C:\Python27\lib\socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 11004] getaddrinfo failed
What's wrong with the codes?