Frage

I'm trying to create a .exe with py2exe.

My application uses envisage and traits packages.

When I run the entry point script using the python interpreter everything is OK, but when I generate the .exe and try to executes the resulting .exe file it gives the following error:

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.

My Core.MainApplication.MainApplication is implemented as follows:

class MainApplication(Application, IApplication):

    Implements(IApplication)

    ...... THE REST OF IT .....

So my application actually is an IApplication.

Here is my setup.py file:

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'
)

Any ideas?

War es hilfreich?

Lösung

I updated my setup.py and now it works, change the "packages" to:

packages=['Platform.Core',
          'Platform.Core.Interfaces',
          'Platform.View',
          'Platform.View.Dialogs',
          'Platform.View.Widgets'...

A silly mistake.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top