473,756 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need a little more help with py2exe/COM problem.

Hello,

I've fiddled with this for quite a while and thought I had the problem
solved. I had a version that would successfully compile and run. But
then I had to change the code to use a different module, and now it
will compile but not run again.

I know that functionality in this area is not fully supported yet, but
there has to be someone out there that has got this to work. I am
using Python2.3, with py2exe 0.4.2, and win32all 159. The fact that
this works with one module and not the other is very confusing.

WHAT WORKED
===========
import win32com.client
import win32com.client .dynamic
import os, os.path

class easyExcel:
def __init__(self, filename=None):
self.xlApp =
win32com.client .dynamic.Dispat ch('Excel.Appli cation')
self.filename = filename
...much more stuff...

WHAT DOESN'T WORK
=============== ==
import win32com.client
import win32com.client .dynamic
import os, os.path

class ExcelEvents:
def getHandle(self, ee):
self.ee = ee
def OnWorkbookBefor eClose(self, wb, wn):
if self.ee.active( ):
print "WORKBOOK IS ACTIVE"
self.ee.hide()
return 1
else:
print "WORKBOOK IS NOT ACTIVE"
return 0

class easyExcel:
def __init__(self, filename=None):
self.xlApp =
win32com.client .dynamic.Dispat ch('Excel.Appli cation')
x_events = win32com.client .WithEvents( self.xlApp, ExcelEvents
)
x_events.getHan dle(self)
For some reason when I use the *dynamic* module, I am able to freeze
and run perfectly. However, when I use the *client* module functions,
I get the following error:

ImportError: No module named
win32com.gen_py .00020813-0000-0000-C000-00000000004
6x0x1x4

I get the same error if I use "DispatchWithEv ents" from the *client*
module instead of using "Dispatch" and "WithEvents ".

Does anyone know why this happens? Why does it work with one module
and not the other one? And is there something special I need to do
while running py2exe to include this module?

Thanks ahead of time for any help,
Marc
Jul 18 '05 #1
1 3872
Just in case anyone else runs into the same problem, I will post what I got
to work so far.

With Py2.3, py2exe 0.4.2, and win32all 157, I was able to get it to work
doing the following (all of which I had done at one point or another, but
not in the correct order or after I had tried a different version).

Make sure and run makepy.py on Excel.
Compiled with the command: python setup.py py2exe --program
"Excel.Applicat ion"

That seemed to work. However I couldn't get it to work using these steps
with win32all 159, and I did create the gen_py directory manually under
win32com.client before running makepy.

"Marc" <mn******@airma il.net> wrote in message
news:43******** *************** ***@posting.goo gle.com...
Hello,

I've fiddled with this for quite a while and thought I had the problem
solved. I had a version that would successfully compile and run. But
then I had to change the code to use a different module, and now it
will compile but not run again.

I know that functionality in this area is not fully supported yet, but
there has to be someone out there that has got this to work. I am
using Python2.3, with py2exe 0.4.2, and win32all 159. The fact that
this works with one module and not the other is very confusing.

WHAT WORKED
===========
import win32com.client
import win32com.client .dynamic
import os, os.path

class easyExcel:
def __init__(self, filename=None):
self.xlApp =
win32com.client .dynamic.Dispat ch('Excel.Appli cation')
self.filename = filename
...much more stuff...

WHAT DOESN'T WORK
=============== ==
import win32com.client
import win32com.client .dynamic
import os, os.path

class ExcelEvents:
def getHandle(self, ee):
self.ee = ee
def OnWorkbookBefor eClose(self, wb, wn):
if self.ee.active( ):
print "WORKBOOK IS ACTIVE"
self.ee.hide()
return 1
else:
print "WORKBOOK IS NOT ACTIVE"
return 0

class easyExcel:
def __init__(self, filename=None):
self.xlApp =
win32com.client .dynamic.Dispat ch('Excel.Appli cation')
x_events = win32com.client .WithEvents( self.xlApp, ExcelEvents
)
x_events.getHan dle(self)
For some reason when I use the *dynamic* module, I am able to freeze
and run perfectly. However, when I use the *client* module functions,
I get the following error:

ImportError: No module named
win32com.gen_py .00020813-0000-0000-C000-00000000004
6x0x1x4

I get the same error if I use "DispatchWithEv ents" from the *client*
module instead of using "Dispatch" and "WithEvents ".

Does anyone know why this happens? Why does it work with one module
and not the other one? And is there something special I need to do
while running py2exe to include this module?

Thanks ahead of time for any help,
Marc

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1720
by: Kathleen Kudzma | last post by:
I'm having a problem with py2exe for Python 2.3. I got fixed the Lookuperror no codec search functions registered: can't find encoding by following the instructions on the py2exe page (added -packages encodings --force-imports encodings). This resolved the codec error. When I tried to create an exe with py2exe I still got the following warnings. Please see the new error I got (after warnings). ...
8
4738
by: Kathleen Kudzma | last post by:
Does anyone know how to resolve the following problem that I'm getting in Python 2.2 and 2.3? PROBLEM: When I try to create a classReader object I get an exception: "SAXReaderNotAvailable: No parsers found". This only happens when I run the ..EXE; it does not happen if I run the .PY file. When I'm running the .EXE this exception doesn't happen immediately. It happens as soon as I try to create a classReader object. Please see the...
0
1389
by: bapeterson | last post by:
I'd like to use PY2EXE to "compile" a program using the VPYTHON module (www.vpython.org). I have an example where this was previously done to the demo script: Hanoi.py (a towers of Hanoi demo) a couple of years back. When I try and duplicate this I get the following warnings of missing modules: warning: py2exe: ********************************** warning: py2exe: * The following modules were not found: warning: py2exe: * Carbon.Folder
6
3948
by: Luc Saffre | last post by:
Hello, I had a strange problem when freezing (using either py2exe or McMillan installer) a script that imports reportlab (which imports PIL (which imports FixTk))). - Python 2.3.3c (also with Python 2.3) - PIL 1.1.4 - Installer or py2exe : latest versions.
5
1658
by: Tim Axtelle | last post by:
I am new to Python and am trying to create a standalone exe from a python script using py2exe 0.5.0 and Python 2.3 without success. I am able to generate the appropriate .exe file but it is not executable. Running it does absolutely nothing. The sourceforge site says that wsvc6 is required for py2exe. Is this true? If so, it is contradiction with the python faq which claims that no C compiler is necessary with py2exe. I also tried...
0
1195
by: upward_spiral2001 | last post by:
Hi. I've got a neat artificial intelligence project I want to distribute as an EXE. I'm using Python, Pygame, and Numeric. My problem is: When I use py2exe, I'm told "The following modules appear to be missing: AppKit, Foundation, dotblas, objc." And then my EXE crashes with a "segmentation fault." I tried the command: python setup.py py2exe --ignores It then compiles w/o complaint, but the EXE still crashes. The setup.py is very...
0
1250
by: kschnee | last post by:
Hi. I've got a neat artificial intelligence project I want to distribute as an EXE. I'm using Python, Pygame, and Numeric. My problem is: When I use py2exe, I'm told "The following modules appear to be missing: AppKit, Foundation, dotblas, objc." And then my EXE crashes with a "segmentation fault." I tried the command: python setup.py py2exe --ignores It then compiles w/o complaint, but the EXE still crashes. The setup.py is very...
5
3444
by: msunderwd | last post by:
Having a problem with "compiling" a Tkinter/python program using py2exe (and pyinstaller, for that matter)... I have several dialogs that are derived from the tkSimpleDialog.Dialog class. These work just fine if run through the interpreter. When I "compile" this with py2exe, I don't see any errors, and when I execute the resulting program, it "appears" to work fine until I invoke one of the derived dialogs. Then, I get the "body" of...
5
1422
by: jmDesktop | last post by:
Hi, I would like to start using Python, but am unsure where to begin. I know how to look up a tutorial and learn the language, but not what all technologies to use. I saw references to plain Python, Django, and other things. I want to use it for web building with database access. What do I use for that? Does it matter what I use on the client side (mootools, or whatever)? My rational for using Python is because I am hoping it will...
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2647
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.