I'm have a fairly simple (in terms of COM) python program that pulls
info from an Access database and creates Outlook contacts from that
information. It uses wxPython for gui and works without problems.
I want to be able to distribute this program using py2exe, but I am
having some problems. I am using a simple setup.py like in the
documentation for the py2exe tool and everything compiles ok, except
that when I run the exe, I get an exception that says "ImportError: no
module named pythoncom." My program used win32com (which appears to be
loaded fine with the executable) until I needed thread support for the
gui. In order to do this, I needed to import pythoncom and call
CoInitialize() and CoUninitialize() manually for the new thread. I
believe it is this use of the pythoncom module that py2exe is having
trouble with.
I tried adding "pythoncom" to the import list in the distutils
setup.py but the py2exe tool gave me a warning that said it couldn't
be located. I am able to import this module just fine in python
scripts and at the interpreter. I am relatively new to COM and its use
with python as well as with distutils and py2exe. If anyone could help
me out with this, it would be greatly appreciated!
Thanks,
Brian 5 3923
A quick search for pythoncom and py2exe yielded this page (which I have
actually used before so I can verify that it works): http://aspn.activestate.com/ASPN/Mail/Message/766627
The piece of magic is, I believe, "pythoncom.frozen = 1" Hopefully this
hasn't changed too much since I last used it.
Let me know if you have troubles, I'll dig up my old scripts that I py2exe'd
Brian
Brian Kelley wrote: A quick search for pythoncom and py2exe yielded this page (which I have actually used before so I can verify that it works):
Oops. I think I was answering the wrong question. What I sent you was
how to py2exe a pythoncom server so I don't think that it is going to
help. Sorry about that. I'll see if I have any more notes on py2exe
and pythoncom.
Brian hl******@uiuc.edu (Brian Hlubocky) wrote in message news:<98**************************@posting.google. com>... I'm have a fairly simple (in terms of COM) python program that pulls info from an Access database and creates Outlook contacts from that information. It uses wxPython for gui and works without problems.
I want to be able to distribute this program using py2exe, but I am having some problems. I am using a simple setup.py like in the documentation for the py2exe tool and everything compiles ok, except that when I run the exe, I get an exception that says "ImportError: no module named pythoncom." My program used win32com (which appears to be loaded fine with the executable) until I needed thread support for the gui. In order to do this, I needed to import pythoncom and call CoInitialize() and CoUninitialize() manually for the new thread. I believe it is this use of the pythoncom module that py2exe is having trouble with.
I tried adding "pythoncom" to the import list in the distutils setup.py but the py2exe tool gave me a warning that said it couldn't be located. I am able to import this module just fine in python scripts and at the interpreter. I am relatively new to COM and its use with python as well as with distutils and py2exe. If anyone could help me out with this, it would be greatly appreciated!
Thanks, Brian
Try posting a message in the PythonWin32 Mail List at ActiveState.com
It's more specific to Windows, than generic Python.
(I'm actually interested in this answer myself) hl******@uiuc.edu (Brian Hlubocky) writes: I'm have a fairly simple (in terms of COM) python program that pulls info from an Access database and creates Outlook contacts from that information. It uses wxPython for gui and works without problems.
I want to be able to distribute this program using py2exe, but I am having some problems. I am using a simple setup.py like in the documentation for the py2exe tool and everything compiles ok, except that when I run the exe, I get an exception that says "ImportError: no module named pythoncom." My program used win32com (which appears to be loaded fine with the executable) until I needed thread support for the gui. In order to do this, I needed to import pythoncom and call CoInitialize() and CoUninitialize() manually for the new thread. I believe it is this use of the pythoncom module that py2exe is having trouble with.
I tried adding "pythoncom" to the import list in the distutils setup.py but the py2exe tool gave me a warning that said it couldn't be located. I am able to import this module just fine in python scripts and at the interpreter. I am relatively new to COM and its use with python as well as with distutils and py2exe. If anyone could help me out with this, it would be greatly appreciated!
py2exe 0.4.x is no longer compatible with the newer win32all versions,
you need the 0.5.0 prerelease for this (which requires Python 2.3, btw).
No docs so far, but samples are included - you have to modify your setup
script a little.
Thomas
Just include the 'pythoncom23.dll'. (usally can be found in
%windir%/system32 -> Windows 2000).
Best Regards,
Kent Hsu
Brian Hlubocky <hl******@uiuc.edu> wrote in message
news:98**************************@posting.google.c om... I'm have a fairly simple (in terms of COM) python program that pulls info from an Access database and creates Outlook contacts from that information. It uses wxPython for gui and works without problems.
I want to be able to distribute this program using py2exe, but I am having some problems. I am using a simple setup.py like in the documentation for the py2exe tool and everything compiles ok, except that when I run the exe, I get an exception that says "ImportError: no module named pythoncom." My program used win32com (which appears to be loaded fine with the executable) until I needed thread support for the gui. In order to do this, I needed to import pythoncom and call CoInitialize() and CoUninitialize() manually for the new thread. I believe it is this use of the pythoncom module that py2exe is having trouble with.
I tried adding "pythoncom" to the import list in the distutils setup.py but the py2exe tool gave me a warning that said it couldn't be located. I am able to import this module just fine in python scripts and at the interpreter. I am relatively new to COM and its use with python as well as with distutils and py2exe. If anyone could help me out with this, it would be greatly appreciated!
Thanks, Brian This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RJS |
last post by:
Hi all,
I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32-
py2.2).
Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222.
In the sample below, commenting out...
|
by: Giles Brown |
last post by:
I'm feeling quite dumb this morning.
I'm trying to build a COM server DLL using py2exe and it ain't working.
Here's what ain't working...
setup_dll.py based on py2exe sample:
"""from...
|
by: x-herbert |
last post by:
Hi,
I have a small test to "compile" al litle script as a WMI-Tester. The
script include a wmi-wrapper and "insert" the Win32-modeles.
here the code:
my "WMI-Tester.py"
-----
import wmi
|
by: Werner Merkl |
last post by:
Hi,
Python is really great, for small to big programs. For my colleagues and
some circumstances I sometimes need to "compile" a script using py2exe.
Cause I use Windows, I like to use the...
|
by: Werner Merkl |
last post by:
Hi,
we have written a Python EXE program, which should run via AUTORUN.INF
from a CD/DVD (Windows of course).
For this CD/DVD we us a imaging tool from Microsoft, which seam to
generate...
|
by: guilligan.geo |
last post by:
Hello,
I'm trying to create an addin for Outlook 2002 using the one provided
in the demo of win32com as a starting point. I've been able to do my
addin and test it if I go the "standard" way...
|
by: bwaha |
last post by:
First time trying to create an executable with py2exe. I have a small
program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
matplotlib ('0.83.2'), win32com (latest?), Numeric...
|
by: zdp |
last post by:
Dear all:
I made a window program by wxPython. Split windows, treectrl, listctrl
and textctrl are used. When I program in python, the look & feel of the
window controls are like the windos XP...
|
by: DarkPearl |
last post by:
Bonjour à tous,
apres avoir créer un service windows avec py2exe,
j'ai ce probleme quand je lance le service :
voici ce que je trouve dans le journal d'evenement :
The instance's SvcRun()...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |