从ftp下载文件时,我的程序没有响应。我正在查看qthread,但对如何使用它感到困惑。
def Download(self):
#self.startbutton1.destroy()
userprofile = environ['USERPROFILE']
tempfile = environ['TEMP']
ftp = FTP('ftpsite')
ftp.login(user='username', passwd = 'PWhere')
ftp.nlst()
ftp.cwd(self.directoryftp)
#Download all file in directory
filenames = ftp.nlst()
print filenames
if not os.path.exists(tempfile + "\\PythonEXE\'s"):
os.makedirs(tempfile + "\\PythonEXE\'s")
for filename in filenames:
local_filename = os.path.join(tempfile + "\\PythonEXE\'s", filename)
file = open(local_filename, 'wb')
ftp.retrbinary('RETR '+ filename, file.write)
file.close()