Python靜態(tài)編譯器的用法

本篇內(nèi)容介紹了“Python靜態(tài)編譯器的用法”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

成都創(chuàng)新互聯(lián)專注于古縣企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。古縣網(wǎng)站建設(shè)公司,為古縣等地區(qū)提供建站服務(wù)。全流程定制開發(fā),專業(yè)設(shè)計,全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

代碼如下:

    def OnBuildOne(self, event):          if self.paths.count != 0:              self.Report.AppendText(self.CompileInfoHead("File"))              path = self.paths[self.List.GetSelection()]              print "Building " + path + " ..."              try:                  py_compile.compile(path, None, None)              except py_compile.PyCompileError, ex:                  print ex              self.Report.AppendText("=-- Build Finished.\n\n")        def OnBuildAll(self, event):          if self.paths.count != 0:              self.Report.AppendText(self.CompileInfoHead("File(s)"))              for path in self.paths:                  print "Building " + path + " ..."                  try:                      py_compile.compile(path, None, None)                  except py_compile.PyCompileError, ex:                      print ex              self.Report.AppendText("=-- Build Finished.\n\n")        def OnBuildDirectory(self, event):          dlg = wxDirDialog(self, "Select a directory for build", self.cfg[2])          if dlg.ShowModal() == wxID_OK:              path = dlg.GetPath()              self.Report.AppendText(self.CompileInfoHead("Directory:", path))              compile_dir(path, 10, None, 1, None)              self.Report.AppendText("=-- Build Finished.\n\n")              self.cfg[2] = dlg.GetPath()                            dlg.Destroy()             def OnAbout(self, event):           dlg = wxMessageDialog(self, "Present by Dracula 2005\n"                                       "Build 2005.05.05\n", "About",                                       wxOK | wxICON_INFORMATION)          dlg.ShowModal()          dlg.Destroy()        def OnResize(self, event):          sizeClient = self.GetClientSize()          self.List.SetSize(sizeClient)          sizeList = self.List.GetClientSize()          self.Report.SetSize(wxSize(sizeClient.width, sizeClient.height-sizeList.height))        def OnClose(self, event):          try:              f = open("config.cfg", "w")              f.write(self.cfg[0])              if self.cfg[0][-1] != '\n':                  f.write("\n")              f.write(self.cfg[1])              if self.cfg[1][-1] != '\n':                  f.write("\n")              f.write(self.cfg[2])              f.close()          except IOError:              pass           sys.path = self.save_sys_path[:]                    self.timer.Stop()          del self.timer           del self.icon           self.Destroy()        def OnQuit(self, event):          self.Close(true)        def PyCheck(self, argv):          argv2 = ['pychecker']          argv2.append(argv)          pychecker.checker2.main(argv2)          #reload(pychecker.checker2)        def AddPath(self, path):          curdir = path         system_dir = curdir + '\\data\\script'          system_core_dir = curdir + '\\data\\script\\core'          subsystem_dir = curdir + '\\data\\subsystem'          subsystem_trashbin_dir = curdir + '\\data\\subsystem\\trashbin'           sys.path = self.save_sys_path[:]          sys.path.append(curdir)          sys.path.append(system_dir)          sys.path.append(system_core_dir)          sys.path.append(subsystem_dir)          sys.path.append(subsystem_trashbin_dir)        def CompileInfoHead(self, str1, str2=""):          return "=-- %s %s Compile %s %s ...\n" % (self.Date(), self.Time(), str1, str2)             def Error(self, error):          self.Report.AppendText(error)        def Output(self, info):          self.Report.AppendText(info)        def Date(self):          t = time.localtime(time.time())           strDate = time.strftime("%Y.%m.%d", t)          return strDate        def Time(self):          t = time.localtime(time.time())           strTime = time.strftime("%I:%M:%S", t)          return strTime        def Notify(self):          self.statusbar.SetStatusText(self.Date() + "   " + self.Time(), 1)    class MyApp(wxApp):  def OnInit(self):  self.frame = MyFrame(NULL, -1, "cd2Py Compiler")  self.frame.Show(true)  return true   cd2Py = MyApp(0)  import sys  class errCatcher:  def __init__(self):  pass  def write(self, stuff):  cd2Py.frame.Error(stuff)  class outCatcher:  def __init__(self):  passdef write(self, stuff):  cd2Py.frame.Output(stuff)  sys.stderr = errCatcher()  sys.stdout = outCatcher()  cd2Py.MainLoop()

“Python靜態(tài)編譯器的用法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

新聞名稱:Python靜態(tài)編譯器的用法
轉(zhuǎn)載來于:http://www.muchs.cn/article10/iidggo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化全網(wǎng)營銷推廣、ChatGPT靜態(tài)網(wǎng)站、外貿(mào)建站、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計