1
我的python程序有許多功能,這些功能在從.py腳本運行時似乎都能正常工作。使用py2exe編譯後,代碼中的幾個部分的行爲非常不一致。py2exe與其源代碼.py文件有不一致的行爲
本節似乎在其失敗中非常一致。
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。