Python py2exe的行为与其源.py文件不一致

Python py2exe的行为与其源.py文件不一致,python,py2exe,Python,Py2exe,我的python程序有许多函数,从.py脚本运行时,这些函数似乎都可以正常工作。使用py2exe编译后,代码的几个部分具有非常不一致的行为 这一部分的失败似乎非常一致 def unzipItem(self, fileName, destination): print "--unzipItem--" zip = zipfile.ZipFile(fileName) nameList = zip.namelist() fileCount = 0 for ite

我的python程序有许多函数,从.py脚本运行时,这些函数似乎都可以正常工作。使用py2exe编译后,代码的几个部分具有非常不一致的行为

这一部分的失败似乎非常一致

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

ProcessDialog从未出现,SetStatusText也从未更新GUI。

对于发生这种情况的原因,这不是一个真正的答案,但使用cx\u Freeze而不是py2exe解决了这个问题