Comments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #172 (new defect)

Opened 5 months ago

Last modified 5 months ago

win32com.gen_py issue persists in 1.4

Reported by: barton@bcdesignswell.com Owned by: giovannibajo
Priority: high Milestone:
Component: PyInstaller Version: PyInstaller 1.4
Severity: major Keywords: win32com, gen_py, EnsureDispatch
Cc:

Description

Despite a patch submission in 2006 found on  http://osdir.com/ml/python.pyinstaller/2006-02/msg00069.html frozen apps fail to locate the win32com.gen_py directory when win32com.client.gencache.EnsureDispatch? is called to create interface files.

I have applied the patch to my pyinstaller-1.3 to solve the problem.

<QUOTE>

--- 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

</QUOTE>

Attachments

Change History

follow-up: ↓ 2   Changed 5 months ago by giovannibajo

I'm sorry about that. Can you confirm that the patch works in 1.4 as well? If so, I'll merge it in for 1.4.1.

in reply to: ↑ 1 ; follow-up: ↓ 3   Changed 5 months ago by barton@bcdesignswell.com

Replying to giovannibajo:

I'm sorry about that. Can you confirm that the patch works in 1.4 as well? If so, I'll merge it in for 1.4.1.

I don't see my reply from this weekend, so I'll repeat: The patch DOES NOT work in 4.1 latest download. I have reverted to 1.3 with the patch applied which works really well.

in reply to: ↑ 2 ; follow-up: ↓ 4   Changed 5 months ago by giovannibajo

Replying to barton@…:

I don't see my reply from this weekend, so I'll repeat: The patch DOES NOT work in 4.1 latest download. I have reverted to 1.3 with the patch applied which works really well.

Thanks. Can you contribute a small complete example that works with 1.3 and fails with 1.4?

in reply to: ↑ 3   Changed 5 months ago by Barton <barton@bcdesignswell.com>

Replying to giovannibajo:

Thanks. Can you contribute a small complete example that works with 1.3 and fails with 1.4?

Yes sir; here you go: ## #### Fix the way win32com works when it's frozen by pyinstaller #### ## NOTE: Delete C:\Python25\Lib\site-packages\win32com\gen_py\init.py ## ## PATCH pyInstaller 1.3:  http://osdir.com/ml/python.pyinstaller/2006-02/msg00069.html

FROZEN = False import sys if hasattr(sys, "frozen"):

FROZEN = True DATABASE_DIRECTORY = "."

else:

DATABASE_DIRECTORY = "C:\Python\IRTT"

del sys DATABASE_FILE_NAME = "TestDatabase?"

def CreateDB(dbFullPath):

""" Create the database file if it doesn't already exist. """ # borrowed without shame from sqlalchemy.databases.access #

## import sqlalchemy.databases.access

import win32com.client, pythoncom

### sqlalchemy.databases.access.py ### ## global const, daoEngine ## if const is None: ## const = win32com.client.constants

# Find the newest version of the DAO lib possible # for suffix in (".36", ".35", ".30"):

try:

daoVersionStr = "DAO.DBEngine%s" %suffix daoEngine = win32com.client.gencache.EnsureDispatch?(daoVersionStr) break

except pythoncom.com_error:

pass

else:

raise

## raise exc.InvalidRequestError?("Can't find a DB engine. " ## "Check  http://support.microsoft.com/kb/239114 for details.")

# Create an empty database. # daoEngine.CreateDatabase?(dbFullPath, win32com.client.constants.dbLangGeneral) # Tell the access Dialect (module) that we've already gotten the connection. #

## sqlalchemy.databases.access.const = win32com.client.constants

# And give it the engine! #

## sqlalchemy.databases.access.daoEngine = daoEngine

Add/Change #172 (win32com.gen_py issue persists in 1.4)

Author


E-mail address and user name can be saved in the Preferences.


Action
as new
 
Note: See TracTickets for help on using tickets.