读书人

大侠请留步! 运行py2exe打包的程序报

发布时间: 2012-05-29 12:16:00 作者: rapoo

大侠请留步!!! 运行py2exe打包的程序报:WindowsError: [Error 3]
C:\Python26\dist>AutoTestProj.exe
Traceback (most recent call last):
File "AutoTestProj.py", line 422, in <module>
File "AutoTestProj.py", line 60, in __init__
File "AutoTestProj.py", line 102, in CreateLeft
WindowsError: [Error 3] : 'C:\\Python26\\dist\\library.zip\\scripts'

scripts这是个文件夹,里面不含中文的文件


Python code
class AutoTestFrame(wx.Frame,listmix.TextEditMixin,listmix.CheckListCtrlMixin):        def __init__(self):        wx.Frame.__init__(self, None, -1, "Produce Auto Test Paltform",pos=wx.DefaultPosition,                                size = (900,600),                                 style=wx.DEFAULT_FRAME_STYLE |wx.SUNKEN_BORDER |wx.CLIP_CHILDREN )        self.Bind(wx.EVT_CLOSE,self.myClose)        #初始化        mainUIHelper.MainUIHelper(self);            #绘画布局        self.Helper.CreateAuiManager([            mainUIHelper.AuiConfigModel(self.CreateLeft(), wx.aui.AuiPaneInfo()##################60                                .Name("left").Caption(u'测试工艺管理').Left()                                .CloseButton(False)                                .MaximizeButton(False)), .............................................................    def CreateLeft(self):        s = "";        self.n_map = {}        #遍历文件夹        defaultScriptFolder = os.path.join(start.GetExecutePath(),"scripts");        if not os.path.exists(defaultScriptFolder):            os.mkdir(defaultScriptFolder);  ##################102行    ..........................................................................if __name__ == '__main__':        app = wx.PySimpleApp()    frame = AutoTestFrame()##############################422行    frame.Show(True)    app.MainLoop()   


[解决办法]
'F:\\AutoTestClientCodes\\dist\\AutoTestProj.exe\\scripts'这个不是个合法路径当然是报错,你的start.GetExecutePath()要返回一个文件夹才行,不是的话os.path.dirname(start.GetExecutePath())取出目录路径

读书人网 >perl python

热点推荐