the server line doesn't need "ftp://"
Fetching data from a ftp server
Question
I have some code like this:
def getnews():
try:
server = 'ftp://25.102.81.171'
ftp= ftplib.FTP(server)
username = ' '
password = ' '
ftp.login(username,password)
filename = 'news_2014.txt'
path = 'news'
ftp.cwd(path)
textlines = []
ftp.retrlines('RETR' + filename, textlines.append)
newswindw = Toplevel(background="grey")
news1 = Label(newswindw, text="textlines", background="white")
news1.pack()
except IOError:
tkMessageBox.showerror("failed", "failed for some reason.")
every time I run it, I get the exception, and if I run it without the try, it gives me a gaeierror: getadderinfo failed any way to fix this?
No correct solution
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow