how to call python code from C#

Dave Brueck dave at pythonapocrypha.com
Mon Jan 24 20:43:50 CET 2005


Peter Hansen wrote:
> paritosh mahana wrote:
> 
>> How can I call python code from my C#  code.
[snip]
> You could use ctypes or the pywin32 package to provide your
> Python code with an ActiveX interface.  Then you could just
> use it via COM, like any other COM object.  Lots of references
> available via Google if you want to learn more about this
> approach...

Lemme add my two cents and say that this approach works well.

We have a component that uses ctypes and runs as a COM local server (its own 
.exe) and we currently use it both from Internet Explorer and from a C# 
application. COM can be hairy initially, but if you have any experience with COM 
then this approach is pretty straightforward.

-Dave



More information about the Python-list mailing list