Python ftp下载导致程序无响应,直到下载完成

Python ftp下载导致程序无响应,直到下载完成,python,download,ftp,qthread,Python,Download,Ftp,Qthread,从ftp下载文件时,我的程序将失去响应。我正在研究qthread,但对如何使用它感到困惑 def Download(self): #self.startbutton1.destroy() userprofile = environ['USERPROFILE'] tempfile = environ['TEMP'] ftp = FTP('ftpsite') ftp.login(user='username', passwd = 'PWhere')

从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()

您使用的是什么UI框架?PyQt?Tkinter是我用于GUI的工具,您使用的是什么UI框架?PyQt?Tkinter是我用于GUI的工具