【问题标题】:Error after creating exe with Py2exe使用 Py2exe 创建 exe 后出错
【发布时间】:2011-05-18 08:07:42
【问题描述】:

Py2exe 似乎运行良好,尽管它确实提到可能缺少一些模块。

我一直在使用 windows 选项(在我的 py2exe 脚本中)来删除控制台窗口,但我意识到即使我关闭了 gui 窗口,该进程仍然保持打开状态,即我仍然可以在任务管理器中看到该进程。 . 所以我切换到使用控制台选项,发现那里打印了以下错误。我相信这个错误会阻止应用程序关闭。除此之外,该应用程序运行良好。

我尝试从一个非常简单的 wxPython GUI 应用程序创建一个 exe,但即便如此我仍然收到此错误,但是我从不包含 wxPython 的应用程序创建可执行文件没有问题。

Debug: src/helpers.cpp(140): 'createActCtx' failed with error 0x0000007b (the filename, directory name, or volume label syntax is incorrect.).)

Python:2.6.6

wxPython:2.8.11.0

Windows 7

py2exe: 0.6.9

# -*- coding: utf-8 -*-


from distutils.core import setup
import py2exe
import glob



excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
            'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
            'Tkconstants', 'Tkinter']

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll',]#'msvcp90.dll']

packages = []#'wx.lib.pubsub']


data_files = [("resources", ['resources/1187958_90214884.jpg'])]
packages = ['wx.lib.pubsub',]
options = {'py2exe': {'compressed': 3,
                          'optimize': 2,
                          'excludes': excludes,
                          'packages': packages,
                          'dll_excludes': dll_excludes,
                          'bundle_files': 1,
                          'dist_dir': 'dist',
                          'xref': False,
                          'skip_archive': False,
                          'ascii': False,
                          'packages': packages,
                        'custom_boot_script': '',
                         }
                }  

#windows=[{'script':'gui.py'}]


for script in ["gui.py"]:
    windows=[{
        'script':[script]
    }]

    setup(options=options, console=[script], zipfile=None, data_files=data_files)                        

【问题讨论】:

    标签: python wxpython py2exe


    【解决方案1】:

    我在使用 py2exe 将 wxPython 代码编译为 exe 时几乎没有遇到任何问题。我有一个教程,你可以在这里试试:

    http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/

    我在使用 2.8.11.0 中包含的新版 pubsub 时遇到了一些问题。你可以在这里阅读主题:http://bit.ly/emoHEr

    那天我最终恢复到以前版本的 wx 主要是因为我没有时间弄清楚我做错了什么。不知道是不是你的问题。

    【讨论】:

    • 谢谢迈克,我尝试了你的设置脚本,但仍然遇到同样的错误。我不认为它的 pubSub 相关,因为我已经对我的应用程序进行了更正,如下所述:[comments.gmane.org/gmane.comp.python.py2exe/4048](在我这样做之前,py2exe 根本不会转换它)。经过一番折腾,我意识到当wx.App.__init__(self) 不包含在OnInit() 方法中时,控制台窗口会关闭。所以这似乎是我的问题的原因,而不是上面提到的错误。
    • 这仍然是一个问题,因为我喜欢使用该调用将 sdterror 重定向到文件。即wx.App.__init__(self, redirect=True, filename=appName_errors.log")
    • 嗯,看来我说得太早了,我现在也有这个问题。 TypeError: sendMessage() takes exactly 2 arguments (3 given) 。还在运行2.8.10.1 吗?
    • 对不起。所以改变了他们通知我 cmets 的方式,所以直到今天我才看到这些。是的,我还在工作中使用 2.8.10.1。您可能想在 wxPython 邮件列表上寻求帮助...或 py2exe 列表。
    猜你喜欢
    • 2014-06-06
    • 1970-01-01
    • 2018-04-07
    • 1970-01-01
    • 2015-12-08
    • 1970-01-01
    • 2012-10-01
    • 1970-01-01
    • 2015-11-20
    相关资源
    最近更新 更多