I am trying do pack my program with py2exe. It uses traits GUI.
After moving the import statement in image.py in function "convert_image" out of the try block the crated exe fails at the second of the following points:
1: dist\traitsui\ui_traits.py: from .image.image import ImageLibrary
2: dist\traitsui\image\image.py: from traitsui.ui_traits import HasBorder, HasMargin, Alignment
File Structure:
root
+-...
+-main.py
+-setup.py
+-dist
+-...
+-main.exe
+-traitsui
+-...
+-ui_tratis.py
+-image
+-image.py
By adding the follow to the image.py
import sys
raise Exception(str(sys.path))
I get: Exception: ['C:\Users...\dist\.']
So it seems that the path is set right.
The error trace:
Traceback (most recent call last):
File "main.py", line 8, in <module>
File "gui\FileSelect.pyc", line 8, in <module>
File "traitsui\api.pyc", line 27, in <module>
File "traitsui\basic_editor_factory.pyc", line 30, in <module>
File "traitsui\editor_factory.pyc", line 32, in <module>
File "traitsui\helper.pyc", line 32, in <module>
File "C:\Users\...\dist\.\traitsui\ui_traits.py", line 158, in <module>
from .image.image import ImageLibrary
File "C:\Users\...\dist\.\traitsui\image\image.py", line 34, in <module>
from traitsui.ui_traits import HasBorder, HasMargin, Alignment
ImportError: cannot import name HasBorder
setup.py: https://gist.github.com/2570888
hmm it seams that there was somthing wrong with the Enthought package I used for the images.
So here the new setup file which works: https://gist.github.com/2570888