Python Cx_冻结exe故障排除

Python Cx_冻结exe故障排除,python,cx-freeze,Python,Cx Freeze,我使用wxpython和boa构造函数编写了一个应用程序。这个应用程序将类实例存储在有序字典中(我导入了odict),并最终将数据存储在本地机器上的一个搁置中。 应用程序按照我的预期运行,所以我想分发它。 之前,我使用过pyinstaller,但了解到python 2.6目前不完全受支持(我验证过,因为我的*exe无法工作),所以我切换到cx\U冻结。我新编译的exe似乎运行正常,但没有创建搁置文件。通过查看build文件夹中的库文件,我没有看到odict模块。我确实看到了谢尔夫。似乎这就是问题

我使用wxpython和boa构造函数编写了一个应用程序。这个应用程序将类实例存储在有序字典中(我导入了odict),并最终将数据存储在本地机器上的一个搁置中。 应用程序按照我的预期运行,所以我想分发它。 之前,我使用过pyinstaller,但了解到python 2.6目前不完全受支持(我验证过,因为我的*exe无法工作),所以我切换到cx\U冻结。我新编译的exe似乎运行正常,但没有创建搁置文件。通过查看build文件夹中的库文件,我没有看到odict模块。我确实看到了谢尔夫。似乎这就是问题所在,但我不知道为什么odict不会自动包含在内。我在运行应用程序时没有遇到任何错误,因此我不确定如何着手查找问题。如有任何提示或建议,将不胜感激

在windows XP上使用python 2.6.6、wx python 2.8.11、cx_freeze 4.2.2

我编写这个示例是为了尝试确定它是否会写入搁置文件,但在运行cx\U freeze之后它不起作用

import wx
import sys
import os
import shelve

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1BUTTON1, 
] = [wx.NewId() for _init_ctrls in range(2)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(557, 369), size=wx.Size(400, 250),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(392, 223))

        self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='button1',
              name='button1', parent=self, pos=wx.Point(0, 0), size=wx.Size(392,
              223), style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
              id=wxID_FRAME1BUTTON1)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnButton1Button(self, event):
        filename='c:\\MakeAShelve.db'
        data=[1,2,3,4]
        database=shelve.open(filename)
        database['data']=data
        database.close()


if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = create(None)
    frame.Show()

    app.MainLoop()
下面是我运行的安装程序,它作为python setup.py build执行

import sys
from cx_Freeze import setup,Executable


includefiles=[]

exe=Executable(
     script="ShelveTesting.py",
     base="Win32Gui",
     )

setup(
     name="TimingDiagram",
     version="0.2",
     description="An Excel Based Timing Diagram Application",
     options={'build_exe':{'include_files':includefiles}},
     executables=[exe]
     )

您始终可以手动包含这样的模块

build_exe_options = {'packages': ['os','sys','shelve'],'include_files':includefiles}
options = {"build_exe": build_exe_options}
注意!! 使用wxpython时,需要特别小心。

如果不包括X,您应该获得
ImportError:没有模块名X
。您从该应用程序收到任何错误消息吗?您可能需要包括
dumbdbm
和/或
dbhash
模块来支持shelve.Woops,刚才注意到这是一个2年前的问题。