py2exe has inconsistent behavior with its source .py files
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.
精彩评论