我有一些像這樣的代碼:獲取數據
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.")
我每次運行它的時候,我得到的異常,如果我沒有試運行它,它給了我一個gaeierror:getadderinfo失敗 有什麼辦法解決這個問題?
可能重複:http://stackoverflow.com/q/20970944/1982962 –
沒有必要問同樣的問題兩次。 –