我正在尝试使用py2exe创建.exe。
我的应用程序使用envisage
和traits
个包。
当我使用python解释器运行入口点脚本时,一切正常,但是当我生成.exe并尝试执行生成的.exe文件时,它会出现以下错误:
Traceback (most recent call last):
File "run_dippo.py", line 14, in <module>
File "Core\MainApplication.pyc", line 246, in run
File "envisage\application.pyc", line 292, in start
File "envisage\application.pyc", line 479, in _create_application_event
File "traits\trait_types.pyc", line 2695, in validate
File "traits\trait_types.pyc", line 2793, in resolve_class
File "traits\trait_types.pyc", line 2526, in resolve_class
File "traits\trait_types.pyc", line 2555, in validate_failed
File "traits\trait_handlers.pyc", line 170, in error
traits.trait_errors.TraitError: The 'application' trait of an ApplicationEvent instance must be an envisage.api.IApplication or None, but a value of <Core.MainApplication.MainApplication object at 0x01E5B5D0> <class 'Core.MainApplication.MainApplication'> was specified.
我的Core.MainApplication.MainApplication实现如下:
class MainApplication(Application, IApplication):
Implements(IApplication)
...... THE REST OF IT .....
所以我的应用程序实际上是一个IApplication。
这是我的setup.py文件:
from distutils.core import setup
import py2exe
setup(
name='Aorta',
version='1.0',
packages=['Core', 'Core.Interfaces', 'View', 'View.Dialogs', 'View.Widgets',
'View.CentralPanels', 'Model', 'Model.Pipelines', 'Model.IOSections', 'Model.VisorAdaptors',
'Model.Visualizations', 'Plugins', 'Plugins.Aorta', 'Plugins.DiPPo', 'Controller', 'Controller.UiLogic',
'Controller.Commands', 'Controller.Commands.DiPPo', 'Controller.Interfaces'],
url='',
license='',
author='Planetarium',
author_email='',
description='',
windows=[{"script":"run_dippo.py"}],
options={'py2exe': {"includes": ['sip', 'PyQt4.QtCore','injector','envisage', 'traits'], "bundle_files": 2}},
zipfile=r'plataforma.zip'
)
有什么想法吗?
答案 0 :(得分:0)
我更新了我的setup.py,现在它可以正常工作,将“包”更改为:
packages=['Platform.Core',
'Platform.Core.Interfaces',
'Platform.View',
'Platform.View.Dialogs',
'Platform.View.Widgets'...
一个愚蠢的错误。