ironpython

Passing DataTable to IronPython

左心房为你撑大大i 提交于 2019-12-23 12:26:24
问题 I have a .NET project where I am using IronPython to perform some processing of the data. At present, the C# code loops through and generates an IronPython script for each row and column that requires dynamic calculation. However, I'd like to make the process more efficient by passing in the DataTable object and a script to execute against it. Unfortunately, I'm getting 'DataTable' object is unsubscriptable error and no processing takes place. C# snippet to generate and execute IronPython

IronPython.Runtime.Exceptions.ImportException: No module named os

本小妞迷上赌 提交于 2019-12-23 12:19:14
问题 Im using IronPython on C#.Net 3.5 app with VS 2015. I read all the post about this Topic, but still get this error. my code: static void Main(string[] args) { var engine = Python.CreateEngine(); var searchPaths = engine.GetSearchPaths(); searchPaths.Add(@"C:\myProject\packages\DynamicLanguageRuntime.1.1.2"); searchPaths.Add(@"C:\myProject\packages\IronPython.2.7.7\lib"); searchPaths.Add(@"C:\myProject"); searchPaths.Add(@"C:\myProject\"where myfile.py exists"); engine.SetSearchPaths

Is IronPython a 100% pure Python variant?

限于喜欢 提交于 2019-12-23 12:01:25
问题 I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup. I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET. I want to know whether IronPython is a pure variant of Python or a modified variant.

Is there a way to call C# script files with better performance results?

我怕爱的太早我们不能终老 提交于 2019-12-23 04:43:10
问题 I am currently calling a C# script file (http://www.csscript.net) from a C# app in Visual Studio 2010 using this method: var script = new AsmHelper(CSScript.Load( @"C:\temp\CSScriptTest\CSScriptTest\cstest.cs")); script.Invoke("*.LoopTest"); But I'm noticing that the performance on this is about twice what it takes to call a similar IronPython script using this method: var ironPythonRuntime = Python.CreateRuntime(); dynamic loadPython = ironPythonRuntime.UseFile( @"C:\temp\IronPythonTest

which argtypes for NetShareAdd

老子叫甜甜 提交于 2019-12-23 04:10:19
问题 The win32 function NetShareDel takes three arguments, LPCWSTR LPCWSTR and DWORD. So I use the following list for argtypes: C.windll.Netapi32.NetShareDel.argtypes = [LPCWSTR, LPCWSTR, c_int] C.windll.Netapi32.NetShareDel.restype = c_int C.windll.Netapi32.NetShareDel(server, shareName, 0) That works fine, but I can't figure out what to use for NetShareAdd, especialle the byte array for NET_SHARE_INFO struct and the last byref(c_int) argument. Here's the code: def Share(server, shareName, dir):

which argtypes for NetShareAdd

让人想犯罪 __ 提交于 2019-12-23 04:09:09
问题 The win32 function NetShareDel takes three arguments, LPCWSTR LPCWSTR and DWORD. So I use the following list for argtypes: C.windll.Netapi32.NetShareDel.argtypes = [LPCWSTR, LPCWSTR, c_int] C.windll.Netapi32.NetShareDel.restype = c_int C.windll.Netapi32.NetShareDel(server, shareName, 0) That works fine, but I can't figure out what to use for NetShareAdd, especialle the byte array for NET_SHARE_INFO struct and the last byref(c_int) argument. Here's the code: def Share(server, shareName, dir):

Running IronPython object from C# with dynamic keyword

被刻印的时光 ゝ 提交于 2019-12-23 04:03:47
问题 I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x, y): return (x+y) I could make the following C# code to use the IronPython code. static void Main() { string source = GetSourceCode("ipyth.py"); Engine engine = new Engine(source); ObjectOperations ops = engine._engine.Operations; bool result = engine.Execute(); if (!result) { Console.WriteLine("Executing Python code failed!"); } else { object klass = engine._scope.GetVariable("Hello"); object instance

Running IronPython object from C# with dynamic keyword

非 Y 不嫁゛ 提交于 2019-12-23 04:03:06
问题 I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x, y): return (x+y) I could make the following C# code to use the IronPython code. static void Main() { string source = GetSourceCode("ipyth.py"); Engine engine = new Engine(source); ObjectOperations ops = engine._engine.Operations; bool result = engine.Execute(); if (!result) { Console.WriteLine("Executing Python code failed!"); } else { object klass = engine._scope.GetVariable("Hello"); object instance

Using Iron Python with Solidworks API

半世苍凉 提交于 2019-12-23 03:04:15
问题 I've been working on scripting some repetitive behaviors in Solidworks using python. I spent a while trying to go through the win32com library and managed to get a lot to work, but ran into a roadblock. So I'm now trying to control the API via Iron Python. Just trying to get rolling and have run into an issue. I've tried to run the code below: import clr clr.AddReferenceToFileAndPath('..\\Redist\\SolidWorks.Interop.sldworks.dll') clr.AddReference('SolidWorks.Interop.swconst') from SolidWorks

Cant add events for controls in WPF IronPython VS2010

冷暖自知 提交于 2019-12-23 02:38:42
问题 I installed VS2010 and IronPython tools. When I start a VB.NET WPFProject everything works fine. But when I start a WPF IronPython project, it creates a button by default which fills all the window, and when you try to add an event to that control or another control dragged from the toolbox, you just cant do it. You double click on them, but the event is never added to the sourcecode. Anyone had this problem? 回答1: Currently we don't have support for double clicking and adding an event handler