tags:

views:

343

answers:

1

Hey, I've been banging my head for the past two days trying to find out if it's possible to run a python module in C#. The module I'm interested in is Sympy which can be found here http://code.google.com/p/sympy/ (in case anyone's interested). It's a math library, and this one does what I need it to do. I haven't found a C# library which is as good (I tested math.net and others..)

From searching google I found out that you can execute python code inside C# using IronPython. Haven't found any real good example of using a module with IronPython or with PythonNet.

Can anyone tell me if it's possible to use a python module in C# and what would he recommend IronPython or PythonNet. Also if it's possible, does it mean my APP will need the python compiler installed to work or will the referenced dll be enough?

In case my question isn't clear enough, feel free to leave a message for clarification.

Thx in advance guys.

+2  A: 

I don't know how well loading a python lib in c# will do ya, but I'd write my program via IronPython.

you can then compile it to an exe so your users don't know the difference.

now this is guesswork, but maybe you can then load your assembly in other c# projects and use it that way. i.e. wrap the python library with ironpython and then load that in c#

its not elegant, but it'll work, I bet.

Oren Mazor
The thing is that in this case, i can only use C#. But thanks for your answer, I will try to research more your suggestions and see what comes out.
byte1918
I still think your best option may be wrapping that python library with a c# assembly, and then just loading that assembly in your c# world, but maybe somebody else has a better idea.other than just straight porting of the library to c#..
Oren Mazor