py2exe - COM Server problem

Thomas Heller theller at python.net
Mon Mar 8 09:50:11 EST 2004


paul.kemp at standardbank.com (Paul) writes:

> Hi all
>
> I've been trying to build a COM Server as an executable using Py2exe. 
> I had a few problems, so I came back to using Thomas Heller's basic
> example (copied below).  When I build this, I still get an error.  I
> can register Python.TestServer (testcomserver.exe --register),
> however, when I try to create an instance of it (e.g. using VBA), a
> command prompt window appears with the title:
>
> d:\...\testcomserver.exe /automate
>
> And the command prompt window just sits there!  Eventually, VBA times
> out.
>
> I really don't understand, because I've succeeded with COM servers and
> Py2Exe in the past, and have never seen this before.
>
> Can anyone help?

I guess that recent changes in pywin32 have broken this (very old) code
you mention.  You should upgrade to Python 2.3 (if you haven't already),
a recent pywin32 build, and to py2exe 0.5.

This version of py2exe contains an example COM server in the
samples\advanced directory - it builds an exe and dll server from the
win32com.servers.interp com example code.

Basically, this 3-line setup script is all that you need, there are no
changes needed to the com server code:

from distutils.core import setup
import py2exe
setup(com_server = ["win32com.servers.interp"])

You can most certainly make the dist folder much smaller by excluding
the pywin package from the build:

python setup.py py2exe --excludes pywin

Thomas





More information about the Python-list mailing list