[python-win32] I need to make a COM object with py2exe. Please HELP!
Tim Roberts
timr at probo.com
Tue Feb 24 19:07:09 CET 2015
Diego Vélez Torres wrote:
>
> I need to make a COM object upon my Python code, so I can call it from
> .NET programs (ie. Visual Basic, VB6). I need the COM object (or DLL)
> to be stand alone, because the target PCs where the final programs are
> going to run won't have Python installed. I know so far that py2exe
> supports this directly:
> http://www.py2exe.org/index.cgi/Py2exeAndCtypesComDllServer
>
> I've tried to make some samples with the given link's instructions,
> but I haven't been lucky. I only got empty 'dist' and 'build' folders.
> I've search for documentation on the web for quite a long time with no
> luck. I realized that I need more information besides the one provided
> by the above's link:
>
> 1. How the Python module that I want to compile must be written? I
> mean, all functions and classes in module will be available for
> the outside code through the COM Object? That module needs
> specific lines of code?
>
What you are trying to create is a COM server. If you search for
"python COM server", you will find many examples. It does have to be
written in a particular way. You have to identify the functions you
want to be exposed, the registry program ID, and the registry GUID in
specially named class members (_public_methods_, _reg_progid_, _reg_clsid_).
I suggest you make the COM part work first. Once you have that working,
then you can dig in to py2exe to make it standalone.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list