2011-04-07 50 views
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。

回答

0

不是一個真正的答案,爲什麼出現這種情況 - 但使用cx_Freeze代替py2exe解決了這個問題。

相關問題