Discussion:
[Python.NET] Loading C# DLLs from CPython
Alex Campbell
2013-03-20 16:16:50 UTC
Permalink
Hi,

We need to access C# managed DLLs from CPython. The obvious choice is
IronPython, but this is not easily possible since we can't swap out the
interpreter. We saw Pythonnet, and from the description it seemed that it
would provide a package for accessing C# from Python.

Unfortunately, rather than a module, it seems to be just the interpreter
(which doesn't avoid the issue of not being able to swap the interpreter
out).

The only other solution we see is to use nPython or IronPython to make a
COM interface, access this COM interface using a python library, and
importing that python library into CPython.

Does anyone see a less convoluted way of doing this?

Thanks,
-Alex
Tony Roberts
2013-03-20 16:34:25 UTC
Permalink
Hi Alex,

you can import the clr module in the standard cPython interpreter, so I
don't think there's any need to use nPython. You just need to make sure
that the clr.pyd module is somewhere on your pythonpath.

regards,
Tony
Post by Alex Campbell
Hi,
We need to access C# managed DLLs from CPython. The obvious choice is
IronPython, but this is not easily possible since we can't swap out the
interpreter. We saw Pythonnet, and from the description it seemed that it
would provide a package for accessing C# from Python.
Unfortunately, rather than a module, it seems to be just the interpreter
(which doesn't avoid the issue of not being able to swap the interpreter
out).
The only other solution we see is to use nPython or IronPython to make a
COM interface, access this COM interface using a python library, and
importing that python library into CPython.
Does anyone see a less convoluted way of doing this?
Thanks,
-Alex
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
b***@public.gmane.org
2013-03-20 16:43:10 UTC
Permalink
You are incorrect that it's just an interpreter. That is one thing it can do. But it also acts as a module. For example, I have pythonnet and .net dlls importing into Autodesk Maya, which is a third party product that embeds it's own cPython. It can get a little more complicated if you need multi-platform support because you need to compile it differently for .net versus mono. But it can be used across all three major platforms.

-brad
Hi,
We need to access C# managed DLLs from CPython. The obvious choice is IronPython, but this is not easily possible since we can't swap out the interpreter. We saw Pythonnet, and from the description it seemed that it would provide a package for accessing C# from Python.
Unfortunately, rather than a module, it seems to be just the interpreter (which doesn't avoid the issue of not being able to swap the interpreter out).
The only other solution we see is to use nPython or IronPython to make a COM interface, access this COM interface using a python library, and importing that python library into CPython.
Does anyone see a less convoluted way of doing this?
Thanks,
-Alex
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
http://mail.python.org/mailman/listinfo/pythondotnet

Loading...