#41: EnsureDispatch and EnsureModule not working on win32
--------------------------+-------------------------------------------------
       Id:  41            |      Status:  new                               
Component:  PyInstaller   |    Modified:  Mon Feb 20 18:19:12 2006          
 Severity:  major         |   Milestone:                                    
 Priority:  normal        |     Version:  PyInstaller 1.0                   
    Owner:  giovannibajo  |    Reporter:  steve at fullmeasure dot co dot uk
--------------------------+-------------------------------------------------
 !EnsureDispatch and !EnsureModule call the makepy code in gencache at
 runtime to greate the early binding support files in the gen_py folder.
 This fails under pyinstaller runtime with an !ImportFailure in
 win32com.client.gencache._GetModule() from the __import__ function due to
 confusion over the various gen_py folders.

 The solution is to change the __path__ of the genpy module to be the
 support\gen_py folder only. Currently this is set by win32com\__init__.py
 to be win32com\gen_py or %temp%\gen_py.

 patch:

 {{{
 --- win32comgenpy1.1.py Mon Sep 12 06:33:10 2005
 +++ win32comgenpy.py    Sun Feb 19 07:28:40 2006
 @@ -34,6 +34,7 @@
  import win32com
  win32com.__gen_path__ = genpydir
  win32com.__path__.insert(0, supportdir)
 +sys.modules["win32com.gen_py"].__path__ = [ win32com.__gen_path__ ]
  # for older Pythons
  import copy_reg
 }}}

 However this is only a partial fix as in order for the files to be
 correctly created at run time the win32com\gen_py or %temp%\gen_py must
 not contain files when the pyinstaller analysis runs. Presumably a issue
 with the package paths and importhook in iu.py, may just need __init__.py
 to fail.

 The current situation also means files may found in a place on a developer
 machine that does not exist on the user's target machine (win32com\genpy)
 causing user errors not seen by developer.

 Out of interest when this works correctly and pyinstaller runtime only
 ever uses it's support\gen_py it will be possible to copy makepy created
 files from win32com\gen_py into the support\gen_py and they will work
 WITHOUT the need to import them.

 Steve Lee

-- 
Ticket URL: <http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi/ticket/41>
PyInstaller <http://pyinstaller.hpcf.upr.edu>
PyInstaller

_______________________________________________
PyInstaller mailing list
[email protected]
http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller

Reply via email to