Thanks Michael that is helpful and from inspection looks like it will
work OK even though the win32com code seems to have changed recently.
After ages I found an alternative solution that also seems to work, see
ticket 41.
Basically I added the following to the rt hook in
pyinstaller1.1\support\rthooks\win32comgenpy.py:
sys.modules["win32com.gen_py"].__path__ = [ win32com.__gen_path__ ]
if (hasattr(sys.modules["win32com.gen_py"], '__importsub__')):
delattr(sys.modules["win32com.gen_py"], '__importsub__')
Some of the path manipulation done in you code appears to be done in the
rt hook which runs at startup. I added setting gen_py.__path__ correctly
as without it files were found in the python installation gen_py.
I hadn't spotted __oldimport__ but stopped the iu import hook getting in
the way for gen_py imports by removing the __importsub__ attr that gets
set on the module by pyinstaller hook. __oldimport__ is probably safer.
One interesting thing is that having run EnsureDispatch in the normal
way you can copy the generated gen_py files into the runtime
suport\gen_py for distribution. That gives slight speedup of first run
as it doesn't need to create the cached files though in my case I need
to ensure they get created on users machine (versions). It might might
also give Dispatch early binding support if you copy the files created
by makepy (there different) but I haven't tried that
My next project uses wxPython as well so will be interested in any
solutions you find.
Steve
michael wrote:
I've just joined the list and I'm trying to keep this on response on a
thread
Steve Lee, I've not managed to get pyinstaller to build my application
yet because I use wxPython and there is currently a problem with the
manner in which wxPython loads, however I do have a workaround which I
use to load COM modules when building with the old version of McMillan
installer. I can't verify that this will work for you but it's quick so
you could give it a try.
First off you'll have to import the module I've attached, then call
set_gen_path() with the genpath. I forget where I found this comhack
but it did help me immensely.
try:
import comhack
import win32com.client.gencache
path = win32com.client.gencache.GetGeneratePath()
comhack.set_gen_path(path)
except:
print 'Unable to manage COM objects'
Hope that helps,
Mike
------------------------------------------------------------------------
_______________________________________________
PyInstaller mailing list
[email protected]
http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller
--
Steve Lee
PowerTalk has your PowerPoint presentations talking, for free
www.fullmeasure.co.uk
_______________________________________________
PyInstaller mailing list
[email protected]
http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller