So I have a good handle on how to rapidly develop a GUI controlled application in .NET (not so much in Python, I've only used Tkinter). I want my code to be easily deployed with very few dependencies. It does however have to interface with a particular 3rd party software package that exposes a very difficult COM API or a much simpler Python API.

I'm thinking about writing a few python scripts to do the processing I need. These scripts will be called as a subprocess from the .NET application. I would complete the project much faster this way instead of spending days working through the COM API.

I feel that the resulting code would also be much simpler and shorter avoiding the COM API, but I will be mixing two languages if I code the application this way. Also I'm not shipping my own python interpreter with it, it will use the one provided with the vendor software.

Is this a terrible idea?

I looked up IronPython, but this 3rd party software apparently requires cpython to leverage it's API, so I'm not sure that will work unless I go the COM route.

  • As long as you're using C# 4.0, you should be fine. C# 4.0 includes the requisite dynamic constructs. This would be difficult in earlier versions of C# Jul 11, 2011 at 19:12
  • 1
    IronPython! Works with .NET 3.5 and is a .NET language its self.
    – Matt Ellen
    Jul 11, 2011 at 19:15

3 Answers 3


You can add Python support to your application by using IronPython. However, you should be aware that this doesn't include any of the Python standard library. You can make calls from your Python script into the .Net runtime with a standard-looking import.

For example, if you wanted access to Decimal.Parse, you would include

from System import Decimal 

at the top of your code.

Embedding IronPython is actually very simple. Here is an article that will help you get started: Link

(Edit to note: You can import Python libraries as well, but you'll need to deploy them with your application, or somehow tell your application where to find the .py files to import.)

  • 1
    Also, CPython extension modules won't work (or at least not easily).
    – user7043
    Jul 11, 2011 at 19:40
  • @delnan That's a really good point! I've heard ironclad will help with that, but I have not used it so can't make any claims as to its usefulness.
    – pmn
    Jul 11, 2011 at 19:44

I would say it depends. The pros of using the Python solution you already told us: easier to handle API. The main con is that the communication to your 3rd party API will go through sub-processes, which may potentially be slower than an in-process COM api call, with less possibilites of error handling and event handling.

As you said Python is already installed on your target machine, deployment seems not to be an issue here. And I would not go the IronPython route as long as the vendor of your 3rd party software does not tell you his Python API was made for that.


In my experience, if your solution can be installed with a single installer, it doesn't matter how many languages or technologies you use, users won't care. Depending on the vendor's Python runtime is probably a good thing, at least you shouldn't have to worry about end-users updating it to a (potentially incompatible) version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.