开发者

py2exe has inconsistent behavior with its source .py files

开发者 https://www.devze.com 2023-02-23 06:41 出处:网络
My python program has many function which all seem to work fine when run from the .py script.After compiling with py2exe several of the secti开发者_如何学JAVAons of code have very inconsistent behavio

My python program has many function which all seem to work fine when run from the .py script. After compiling with py2exe several of the secti开发者_如何学JAVAons of code have very inconsistent behavior.

This section seems to be very consistent in its failure.

def unzipItem(self, fileName, destination):
    print "--unzipItem--"
    zip = zipfile.ZipFile(fileName)
    nameList = zip.namelist()

    fileCount = 0
    for item in nameList:
        fileCount += 1

    dlg = wx.ProgressDialog("Unziping files",
                           "An informative message",
                           fileCount,
                           parent = self,
                           )

    keepGoing = True
    count = 0

    for item in nameList:
        count += 1
        dir,file = os.path.split(item)
        print "unzip " + file

        self.SetStatusText("Unziping " + str(item))
        (keepGoing, skip) = dlg.Update(count, file)
        zip.extract(item,destination)

    zip.close()
    dlg.Destroy()

The ProcessDialog never appears, and the SetStatusText never updates the GUI.


Not a real answer as to why this occured - but using cx_Freeze instead of py2exe solved this problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消