osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: [PyInstaller] #41: EnsureDispatch and EnsureModule
not working on win32 - msg#00069

List: python.pyinstaller

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

#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


Thread at a glance:

Previous Message by Date:

Re: problems with the snapshot (r272) on winxp

Pavol Severa <pavol.severa-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote: >> Uhm what was the last version which worked for you? Does --onedir work? >> Did you clean the build* / dist* directories after having upgraded? > > last I tried was 1.1, with an updated Build.py (when you solved > problems with UPX). > I have the problem with --onedir as well (in fact, what I described > above was with onedir - I just ran Makespec.py with no options). I > used a "clean install", i.e. I put a fresh copy of the snapshot to > Desktop, run Configure.py and then put in the trial script I wanted to > make exe of, so there were no old directories. (It's quite possible I > do something wrong that leads to this strange thing, unfortunately I > don't know what :) Well, I have recompiled the bootloader to fix the icon issues but I just added the resource section to it. I don't understand why it should now crash on you! -- Giovanni Bajo

Next Message by Date:

Re: Import problem with win32clientgencache andEnsureDispatch()

Giovanni Bajo wrote: OK let me know. I don't have time at the moment to investigate this failure but I will. Will you please open a ticket on the website so that I don't forget? Done, notes: I could not escape __ being underline. PyInstaller 1.1 not in version list. You could do with a OS platform tick parameter. Host and/or target? Steve

Previous Message by Thread:

problems with the snapshot (r272) on winxp

Hello I tried the devel snapshot (r272) on winxp, and I have the following problem: when I create an exe file and then run it, the well-known hated dialog "the application blabla caused a problem and needs to be closed; do you want to send a message to Microsoft about this problem?" appears. This happens for any config spec options I tried, with a script contraining just 1 line " print 'it works' ". I don't know what info could be helpful; this is what is on that "complain to Microsoft" dialog: AppName: pok.exe AppVer 0.0.0.0 ModName ntdll.dll ModVer: 5.1.2600.2180 Offset 00018fea (pok.py was the name of the script) Exception Information: Code: 0xc0000005 Flags: 0x000000000 Record: 0x0000000000000000 Address: 0x000000007c928fea and then a lot of other stuff that cannot be copy'n'pasted and looks horrible anyway. If there is any info that might be helpful please let me know. Best regards P.

Next Message by Thread:

Re: [PyInstaller] #41: EnsureDispatch and EnsureModule not working on win32

#41: EnsureDispatch and EnsureModule not working on win32 --------------------------+------------------------------------------------- Id: 41 | Status: new Component: PyInstaller | Modified: Tue Feb 21 13:05:16 2006 Severity: major | Milestone: Priority: normal | Version: PyInstaller 1.1 Owner: giovannibajo | Reporter: steve at fullmeasure dot co dot uk --------------------------+------------------------------------------------- Changes (by steve at fullmeasure dot co dot uk): * version: PyInstaller 1.0 => PyInstaller 1.1 Comment: More info: The reason for the noted failure is that when the win32com\gen_py has an __init.py it gets added to the imported modules and at runtime the gencache.genpy module is that found in out1.pyz/win32com.gen_py rather than that created in gencache.__init__.py. Then iu importhook sees it and fails to import correctly from support\gen_py even though the __path__ is set. Solution is to add {{{ if (hasattr(sys.modules["win32com.gen_py"], '__importsub__')): delattr(sys.modules["win32com.gen_py"], '__importsub__') }}} after patch above and the iu imports it properly. Sorted. '''Warning''': I have not tested if this interferes with makepy support as I have been unable to get direct import of gen_py files to work at all. ----- Observation: EnsureDispatch creates the gen_py files in a different format to Makepy and I noticed that the version checking code in EnsureModule seems to assume the makepy version. This may be a small bug. -- Ticket URL: <http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi/ticket/41> PyInstaller <http://pyinstaller.hpcf.upr.edu> PyInstaller
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!