Hi, first let me say many thanks for keeping the old McMillan installer going. I used to use it for my program (fullmeasure.co.uk/powertalk) but after hitting a problem with a release of win32all and finding McMillan gone I switched to py2exe but have now hit problems with that. Anyone know how Gordan is?

Right my problem: I have a COM client that needs to use the early binding gen_py modules and so uses gencache.EnsureDispatch() rather that the usual Dispatch() which falls back to Dynamic/late binding. This is mainly coz Mark Hammond told me to :-| (I use COM constants and event sinks).

The problem is that the modules are NOT found in the pyinstaller gen_py folder. This is actually hidden on a dev machine as it picks them up from the lib\win32com or %temp% gen_py folders so you have to delete them first to show the problem. This then repros the target machine setup where the users doesn't have a python distro installed. This all works fine when using Dispatch().

I've gone rather code blind so could do with some help. I'm guessing it needs a hook but don't understand quite what/how they work. It seems EnsureDispatch() is not used much and exercises the code differently so there are perhaps problems in the win32com.gencache code.


OK this minimal code, which should work on any XP box, shows the problem

from win32com.client.gencache import EnsureDispatch
v = EnsureDispatch("Sapi.SpVoice")    # Dispatch() is fine
v.Speak( "Hello.")

built with:

makespec.py --onedir PITest.pyw


Traceback (most recent call last):
  File "<string>", line 7, in ?
  File out1.pyz/win32com.client.gencache", line 545, in EnsureDispat
ch
  File out1.pyz/win32com.client.gencache", line 529, in EnsureModule

  File out1.pyz/win32com.client.gencache", line 291, in MakeModuleFo
rTypelib
  File out1.pyz/win32com.client.makepy", line 279, in GenerateFromTy
peLibSpec
  File out1.pyz/win32com.client.gencache", line 561, in AddModuleToC
ache
  File out1.pyz/win32com.client.gencache", line 649, in _GetModule
  File "C:\Python24\pyinstaller_1.0\iu.py", line 329, in importHook
    raise ImportError, "No module named %s" % fqname
ImportError: No module named win32com.gen_py.C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x0



I initially thought it was the fact that the _GetModule() looks for win32com.gen_py.<CLSID> and that is not the path under the pyInstaller created 'support' folder but it seems to work OK for Dispatch(), I guess via these mysterious hooks.

BTW the fact that pyInstaller uses it's own gen_py folder is better than py2exe as it reduces interactions with the python installation or user copies causing differences between dev and target machines.

Regards

Steve Lee
---------
fullmeasure.co.uk
Open Source Assistive Technology Software - OATS
_______________________________________________
PyInstaller mailing list
[email protected]
http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller

Reply via email to