python application dll

Chris Mellon arkanes at
Tue Nov 20 15:36:28 CET 2007

On Nov 20, 2007 8:12 AM,  <dongarbage at> wrote:
> On Nov 19, 3:49 pm, Larry Bates < at> wrote:
> > dongarb... at wrote:
> > > Hi,
> >
> > > Is there a way to create a .dll from a python program which includes
> > > the python runtime?
> >
> > > I'm building a Windows application (C# VisualStudio2005) and I'd like
> > > to utilize some of the functionality available in a Python module. For
> > > my users who install my Windows application, I'd prefer that they not
> > > have to install the entirety of Python on their machines.
> >
> > > Thanks much,
> > > D
> >
> > Turn the Python program into a COM object instead.  Then it can be dispatched by
> > any programming language and distributed after bundling with py2exe.
> >
> > -Larry
> OK, I'm a newbie and not sure how to create/call COM objects. This is
> probably not a question for a python newsgroup, but what the heck: How
> do you turn a python program into a COM object? And, what does it mean
> to be "dispatched"?

You're getting in far above your head - these are advanced concepts
and require a fairly detailed low level knowledge of .NET, Python, and

Firstly, you should be aware that doing this will still require your
users to "install all of Python" on their machine, or at least a large
subset, because you'll need a good portion of the standard library to
do anything useful.

You should look at the python for .NET project  and IronPython,
depending on your needs.

Python for .NET is a .NET <-> CPython bridge, which will allow you to
create and drive a CPython interpreter from .NET. This instance of
Python will be able to use regular CPython extension modules, as well
as (through the bridge) call back up into .NET code. It requires a
working CPython installation.

IronPython is a pure .NET implementation of Python, and will allow you
have a Python interpreter that can load .NET assemblies, but it won't
be able to load Python C modules. It requires installation like all
.NET libraries do, but no CPython installation - it's a separate
implementation of Python.

More information about the Python-list mailing list