Cannot register dll created using "py2exe --com-dll"

Giles Brown giles_brown at
Tue Jul 29 10:52:01 CEST 2003

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... based on py2exe sample:
"""from distutils.core import setup
import py2exe

setup(name="MadeUpName Object Model", 

Command line for building dll (N.B. python 2.3 as instructed):
"""c:\python23\python madeupname/ py2exe --com-dll --excludes Tkinter"""

Command line for registering dll:
regsvr32 c:\pvcs\madeupname\model\dist\application.dll

Result when I try to register dll:
"""DllRegisterServer in c:\pvcs\madeupname\model\dist\application.dll failed.
Return code was: 0x80040201

The winerror.h entry for this says:
// MessageText:
//  Unable to obtain server's security context
#define CO_E_FAILEDTOGETSECCTX           _HRESULT_TYPEDEF_(0x80040201L)

But I'm guessing that this is simply a way of saying the I haven't told
pythoncom (via py2exe) which classes to register.  I'm looking at the
source and I am trying to work it out but failing :-(

I have tried an exe server, but this does not register either.

Any suggestions?

Also does anyone know what argument to use to get py2exe to build something
other than "application.[dll/exe]".  I thought 'output_base' as an argument
to setup() would do it, but no joy.

If you folks can make me feel even more stupid by pointing out my
obvious mistake, that would make me happy. :-)

Thanks for reading,
Giles Brown

More information about the Python-list mailing list