python.net

Python for .NET: How to explicitly create instances of C# classes using different versions of the same DLL?

偶尔善良 提交于 2019-11-29 07:13:05
I have a .cs file like namespace SomeNamepace { public struct SomeStruct { .... } public static class SomeClass { .... } So far I use it with PythonNET like import clr clr.AddReference('c:\\Test\Module.dll') from SomeNamepace import SomeClass, SomeStruct SomeClass.SomeMethod(...) My problem is now that I need to work with dlls with identical names and no version number set, so PythonNET will not see them as two different dlls but as the same. Even if I import them using the full path with AddReference. Now I would like to use them explicitly as stated here: Python for .NET: Using same .NET

Calling python code(.py files) from C#

我的未来我决定 提交于 2019-11-29 07:08:18
I have some python code that does a certain task. I need to call this code from C# without converting the python file as an .exe, since the whole application is built on C#. How can I do this? If your python code can be executed via IronPython then this is definitely the way to go - it offers the best interop and means that you will be able to use .Net objects in your scripts. There are many ways to invoke IronPython scripts from C# ranging from compiling the script up as an executable to executing a single script file or event dynamically executing expressions as they are typed in by the user

Integration of python in C# Application

混江龙づ霸主 提交于 2019-11-29 04:09:42
I have the following problem: I got an old application which is written in python. This application allows the user to specify small python steps which will be executed, python steps are basically small python scripts, I call them steps because the execution of this application involves other steps like executing something from commandline. These python steps are stored as python code in an xml file. Now I want to rewrite the application by using C# .NET. Is there a best practise solution to do something like this? I don't want to call python as external programm and pass the actual python

IronPython vs. Python .NET

妖精的绣舞 提交于 2019-11-28 15:29:36
问题 I want to access some .NET assemblies written in C# from Python code. A little research showed I have two choices: IronPython with .NET interface capability/support built-in Python with the Python .NET package What are the trade-offs between both solutions? 回答1: If you want to mainly base your code on the .NET framework, I'd highly recommend IronPython vs Python.NET. IronPython is pretty much native .NET - so it just works great when integrating with other .NET langauges. Python.NET is good

Python for .NET: How to explicitly create instances of C# classes using different versions of the same DLL?

北城余情 提交于 2019-11-28 01:07:40
问题 I have a .cs file like namespace SomeNamepace { public struct SomeStruct { .... } public static class SomeClass { .... } So far I use it with PythonNET like import clr clr.AddReference('c:\\Test\Module.dll') from SomeNamepace import SomeClass, SomeStruct SomeClass.SomeMethod(...) My problem is now that I need to work with dlls with identical names and no version number set, so PythonNET will not see them as two different dlls but as the same. Even if I import them using the full path with

Can scikit be used from IronPython?

可紊 提交于 2019-11-28 00:26:25
I saw that numpy can be used from IronPython : https://www.enthought.com/repo/.iron/ Is it possible to install and import scikit in IronPython? Im trying to interface between a module written in python 2.7 with scikit and an external COM object with IronPython... Thanks IronPython is certainly not supported by scikit-learn, and I doubt that it'll work without significant effort. The NumPy and SciPy for IronPython document describes the porting effort required for SciPy, and this has certainly not been done for scikit-learn, which too depends heavily on Cython-generated C code (unless someone

Integration of python in C# Application

牧云@^-^@ 提交于 2019-11-27 17:59:51
问题 I have the following problem: I got an old application which is written in python. This application allows the user to specify small python steps which will be executed, python steps are basically small python scripts, I call them steps because the execution of this application involves other steps like executing something from commandline. These python steps are stored as python code in an xml file. Now I want to rewrite the application by using C# .NET. Is there a best practise solution to

Call Python from .NET

怎甘沉沦 提交于 2019-11-27 13:47:44
问题 I have some code written in Python which can not be transferred to a .NET language. I need to call one of these functions from my .NET WinForms application. Now, I do it by starting the Python script as a separate process and pass parameters to it as command line arguments. It works, but I don't really like this solution. I'd like to improve it to a better one. Is there any better way to call a function of a .py script from a .NET application? What is the best way to do it? Note: IronPython

How to install Python for .NET on Windows

左心房为你撑大大i 提交于 2019-11-27 11:58:41
I downloaded Python for .NET . Inside the zip is clr.pyd , nPython.exe , Python.Runtime.dll and 2 debug database files. I put the clr.pyd and Python.Runtime.dll in my python DLLs dir C:\Python27\DLLs thinking this is all that's needed for installation. I then open up the Python GUI and type import clr and I get: Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> import clr SystemError: dynamic module not initialized properly New to python but not .NET and want to use the CPython and not IronPython. What am I missing in this installation? The readme of Python for .NET

Python for .NET “unable to find assembly” error

瘦欲@ 提交于 2019-11-27 04:41:42
问题 I'm using CPython and I have a C# dll. I'm trying to use Python for .NET to make them talk. I can't use IronPython because I need to integrate this into an existing CPython system. I'm completely new to Python for .NET, and I actually have very little experience with Python and no experience with C#. So please forgive me if my question seems very basic. I'm using Python 2.7.3, and I downloaded pythonnet-2.0-alpha2-clr2.0_131_py27_UCS2 and unzipped it into a folder named pyfornet_test, which