ironpython

Can scikit be used from IronPython?

扶醉桌前 提交于 2019-11-26 21:41:26
问题 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 回答1: 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

Instantiating a python class in C#

谁说我不能喝 提交于 2019-11-26 21:27:22
I've written a class in python that I want to wrap into a .net assembly via IronPython and instantiate in a C# application. I've migrated the class to IronPython, created a library assembly and referenced it. Now, how do I actually get an instance of that class? The class looks (partially) like this: class PokerCard: "A card for playing poker, immutable and unique." def __init__(self, cardName): The test stub I wrote in C# is: using System; namespace pokerapp { class Program { static void Main(string[] args) { var card = new PokerCard(); // I also tried new PokerCard("Ah") Console.WriteLine

How to use a C# dll in IronPython

主宰稳场 提交于 2019-11-26 18:18:53
问题 I have created a dll using C#. How do use the dll in IronPython. I have tried to add the dll using clr.AddReference("yxz.dll") . But it fails. I have tried placing the dll in the execution directory of the IronPython script. Still it fails stating that "Name xyz cannot be found" while trying to refer the dll. 回答1: import clr clr.AddReferenceToFileAndPath(r"C:\Folder\Subfolder\file.dll") is the simplest way as proposed by Jeff in the comments. This also works: import clr import sys sys.path

Embedding IronPython in C#

孤者浪人 提交于 2019-11-26 16:38:59
问题 I am just looking into using IronPython with C# and cannot seem to find any great documentation for what I need. Basically I am trying to call methods from a .py file into a C# program. I have the following which opens the module: var ipy = Python.CreateRuntime(); var test = ipy.UseFile("C:\\Users\\ktrg317\\Desktop\\Test.py"); But, I am unsure from here how to get access to the method inside there. The example I have seen uses the dynamic keyword, however, at work I am only on C# 3.0. Thanks.

IDE for ironpython on windows

故事扮演 提交于 2019-11-26 15:40:06
问题 I am currently learning ironpython and loving but i'm looking to move on from using notepad++ and cmd.exe and try using something with a bit more juice. I recently learned that iron python studio does not support iron python 2 so that makes my choice a bit more difficult. Is their any IDE's for windows that would be good iron python 2 development? 回答1: SharpDevelop with IronPython 2.0 Beta Integration is worth a look - especially given that it's free. Also, check out this Iron Python 2 - what

What is a safe way to stop a running thread?

怎甘沉沦 提交于 2019-11-26 14:29:54
问题 I have a thread which contains execution of an IronPython script. For some reason I may need to stop this thread at any time, including script execution. How to achieve this? The first idea is Thread.Abort() , but it's known to be evil... 回答1: Well from you question and subsequent comments I can suggest you two options, with some additional "warnings": If your thread loops executing something on each iteration, you can set a volatile boolean flag such that it exits after finishing the current

Calling a C# library from python

柔情痞子 提交于 2019-11-26 12:08:02
Anyone can share a working example on how to call a simple C# library (actually its WPF) from python code? (I have tried using IronPython and had too much trouble with unsupported CPython library my python code is using so I thought of trying the other way around and calling my C# code from Python). Here is the example I was playing with: using System.Runtime.InteropServices; using System.EnterpriseServices; namespace DataViewerLibrary { public interface ISimpleProvider { [DispIdAttribute(0)] void Start(); } [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] public class PlotData :

Instantiating a python class in C#

怎甘沉沦 提交于 2019-11-26 09:06:23
问题 I\'ve written a class in python that I want to wrap into a .net assembly via IronPython and instantiate in a C# application. I\'ve migrated the class to IronPython, created a library assembly and referenced it. Now, how do I actually get an instance of that class? The class looks (partially) like this: class PokerCard: \"A card for playing poker, immutable and unique.\" def __init__(self, cardName): The test stub I wrote in C# is: using System; namespace pokerapp { class Program { static void

How can I call (Iron)Python code from a C# app?

末鹿安然 提交于 2019-11-26 07:56:19
问题 Is there a way to call Python code, using IronPython I assume, from C#? If so, how? 回答1: The process is simple, especially in a C#/.NET 4 application where support for dynamic languages have been improved via usage of the dynamic type. But it all ultimately depends on how you intend to use the (Iron)Python code within your application. You could always run ipy.exe as a separate process and pass your source files in so they may be executed. But you probably wanted to host them in your C#

Find and Replace Inside a Text File from a Bash Command

天涯浪子 提交于 2019-11-26 03:18:10
问题 What\'s the simplest way to do a find and replace for a given input string, say abc , and replace with another string, say XYZ in file /tmp/file.txt ? I am writting an app and using IronPython to execute commands through SSH — but I don\'t know Unix that well and don\'t know what to look for. I have heard that Bash, apart from being a command line interface, can be a very powerful scripting language. So, if this is true, I assume you can perform actions like these. Can I do it with bash, and