Hello. 

I'm trying to use PyInstaller for a program that uses the traitsui package 
with specific features from the 'wx' backend. I've seen posts of it being 
done with the 'qt4' backend and examples on the web, but I can't use qt4 
this time. So, if anyone knows how to use PyInstaller with traits/wx, I'd 
appreciate the help.

I've tried using the hook file I found here:
https://groups.google.com/forum/?fromgroups=#!topic/pyinstaller/MB_K3bu38T8[1-25]
with the required modification, but as far as I can tell it is never used. 
It is included in my specfile through 

"""
a = Analysis(['pyptv_gui/pyptv_gui.py'],
             pathex=['/home/yosef/pyptv-git'],
             hiddenimports=[],
             hookspath='hooks/')
"""

I added the following lines to see if it works:
"""
f = open("log", "w")
f.write(repr(hiddenimports) + "\n")
f.close()
"""
But the log file does not get created. How do I debug hooks inclusion?

As an alternative, I added explicit imports to the top of my main file. 
I've first added the lines from the hook file exploring which modules are 
needed:
"""
from enthought.etsconfig.api import ETSConfig;
ETSConfig.toolkit = "wx";
import enthought.pyface.api;
import sys;
mods = [m for m in sys.modules if m.startswith("enthought.")];
print sorted(mods)
"""

Then I've run my main file, got that list and added an import for each 
result, like so:
"""
import wx
import enthought.pyface
import enthought.pyface.ui.wx.init
import enthought.traits.ui.wx
from enthought.pyface.action.api import MenuManager
from enthought.pyface.image_resource import ImageResource
import enthought.pyface.api
import enthought.pyface
import enthought.pyface.action
import enthought.pyface.action.api
import enthought.pyface.image_resource
import enthought.pyface.ui
import enthought.pyface.ui.wx
import enthought.traits
import enthought.traits.ui
import enthought.traits.ui.wx.toolkit
"""

This helps, and import errors I got at first were removed, but still not 
all modules are included. I am now stuck with
"""
  File 
"/home/yosef/pyptv-git/build/pyi.linux2/pyptv_gui/out00-PYZ.pyz/pyface.expandable_header",
 
line 31, in <module>
  File 
"/home/yosef/pyptv-git/build/pyi.linux2/pyptv_gui/out00-PYZ.pyz/pyface.expandable_header",
 
line 40, in ExpandableHeader
  File 
"/home/yosef/pyptv-git/build/pyi.linux2/pyptv_gui/out00-PYZ.pyz/pyface.toolkit",
 
line 92, in __init__
NotImplementedError: the wx pyface backend doesn't implement ImageResource
"""

As the list above shows, enthought.pyface.image_resource (where 
ImageResource comes from) was imported, and it shows up in the packed 
archive using ArchiveViewer:
'pyface.image_resource': (False, 1368502, 249)

What else can I do to make this work?

Thanks in advance,
Yosef.

PS - to make sure no problems are created from earlier files, archives that 
weren't updated etc., I use the following to do the packing:
function rebuild { rm -r build/; rm -r dist; ~/epd/bin/python 
~/pyinstaller-pyinstaller-3d7d03f/pyinstaller.py pyptv_gui.spec; }

I use the development version of PyInstaller, and the EPD's python 2.7.2 
(using the system Python with EPD in the PYTHONPATH produces import errors 
for module struct).

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pyinstaller/-/rzQJQ8dFTFoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to