COM / .NET

Tim Golden mail at timgolden.me.uk
Thu Oct 20 04:42:11 EDT 2011


On 20/10/2011 09:06, Uffe Kousgaard wrote:
> Is python able to access COM libraries or .NET assemblies? If both, which is
> the easist or most popular?

You have a few choices in this regard:

* CPython can access COM objects either via the pywin32 extensions[1]
or via comtypes[2]. The former is maintained and is quite mature and
stable (and has recently had a small fix made to allow more flexibility 
when dealing with COM VARIANTS). comtypes, I think, unmaintained,
although perfectly usable and somewhat more flexible than pywin32
in certain respects.

* Python.NET [3] is a project which was dormant for a while but which
is now maintained once more. This is a sort of bridge between
CPython and the .NET assemblies.

* IronPython [4] is a project, originally run inside Microsoft, now
spun off as an Open Source project, which re-implements Python
as a 1st-class .NET language running on the DLR. From that you
have full access to the .NET Framework and its facilities.

[1] http://sourceforge.net/projects/pywin32/

[2] http://pypi.python.org/pypi/comtypes

[3] http://pythonnet.sourceforge.net/
(not sure if that's the canonical URL for that project or not)

[4] http://ironpython.net/

TJG



More information about the Python-list mailing list