ironpython

run Python functions from vb.net

别说谁变了你拦得住时间么 提交于 2019-12-22 06:49:24
问题 I am new with vb.net. I am trying to call python functions from vb.net but getting error that 'Invoke' is not a member of 'Microsoft.Scripting.Hosting.ObjectOperations' Imports Microsoft.Scripting Imports Microsoft.Scripting.Hosting Imports IronPython.Hosting Sub Main Dim engine As ScriptEngine Dim scope As ScriptScope Dim i As Integer engine = Python.CreateEngine() scope = engine.ExecuteFile("C:\Working.py") Dim v = engine.Operations.Invoke(scope.GetVariable(methodName)) ' name of the method

Are CPython, IronPython, Jython scripts compatible with each other?

纵然是瞬间 提交于 2019-12-22 05:04:10
问题 I am pretty sure that python scripts will work in all three, but I want to make sure. I have read here and there about editors that can write CPython, Jython, IronPython and I am hoping that I am looking to much into the distinction. My situation is I have 3 different api's that I want to test. Each api performs the same functionality code wise, but they are different in implementation. I am writing wrappers around each language's apis. Each wrapper should expose the exact same functionality

Is it possible run python in .NET application?

笑着哭i 提交于 2019-12-22 04:55:21
问题 In .NET application is possible save C# code in text file or database as string and run dynamically on the fly. This method is useful in many case such as business rule engine or user defined calculation engine and etc. Here is a nice example: using System; using System.Collections.Generic; using System.Linq; using Microsoft.CSharp; using System.CodeDom.Compiler; class Program { static void Main(string[] args) { var csc = new CSharpCodeProvider(new Dictionary<string, string>() { {

Accessing C# class members in IronPython

妖精的绣舞 提交于 2019-12-22 04:16:10
问题 In my C# code I have a class which stores some data I wish to pass down to my python code in a List. However, when I try to access properties of that class inside my python code I get MissingMemberException . Here some example code to show what I mean: C#: class Event { public int EventId { get; set; } public string EventName { get; set; } } //other processing here... //this just fills the list with event objects List<Event> eventList = GetEvents(); //this sets a variable in the ScriptScope

Getting traceback information from IronPython exceptions

半腔热情 提交于 2019-12-22 03:18:13
问题 I have IronPython hosted within my application, whenever I catch an exception thrown from a script, I get unhelpful gibberish like this: IronPython.NewTypes.System.Exception_1$1: Error occurred during conversion ---> Microsoft.Scripting.ArgumentTypeException: expected int, got DispMethod at _stub_$245##245(Closure , CallSite , Object ) at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 target, CallSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1

Referencing Python “import” assemblies when calling from IronPython in C#

早过忘川 提交于 2019-12-22 01:34:14
问题 I'm a complete noob when it comes to IronPython. I need to call a py script from an ASP.NET website, and have the following code: var ipy = IronPython.Hosting.Python.CreateRuntime(); dynamic test = ipy.UseFile(Server.MapPath(@"~\python\test.py")); test.DoWork(); The version of IronPython I'm using is 2.7. The 3rd party python file I need to call has the following import directives: import sys from array import * from subprocess import * I'm receiving the error "No module named subprocess". I

Ironpython call numpy problem

孤街醉人 提交于 2019-12-21 22:16:27
问题 Ironpython 2.6, python 2.6.5, numpy, SciPy import sys sys.path.append(r'D:\Python26\dll') sys.path.append(r'D:\Python26\Lib') sys.path.append(r'D:\Python26\Lib\site-packages') » import numpy Traceback (most recent call last): File "", line 1, in File "D:\Python26\Lib\site-packages\numpy\__init__.py", line 132, in File "D:\Python26\Lib\site-packages\numpy\add_newdocs.py", line 9, in File "D:\Python26\Lib\site-packages\numpy\lib\__init__.py", line 4, in File "D:\Python26\Lib\site-packages\numpy

Iron Python Twisted

混江龙づ霸主 提交于 2019-12-21 21:46:43
问题 Is there an Iron Python .net port of the twisted libraries, or can Iron Python use the standard one? 回答1: Twisted will not currently run in IronPython, but it is being worked on. Stay tuned. 回答2: I've not used it myself, but you may get some mileage out of Ironclad - it supposedly lets you use CPython from IronPython... 来源: https://stackoverflow.com/questions/676681/iron-python-twisted

How do I install IronPython 2.0 with NGEN'ed binaries?

安稳与你 提交于 2019-12-21 21:12:11
问题 Does anyone know how to install IronPython 2.0 with NGEN'ed binaries using the MSI package? The official IronPython homepage says that the NGEN option will greatly improve startup time, but for some reason it is not enabled by default. It doesn't actually state which MSI parameters you need pass to enable it, and I couldn't find a documentation page on the site, so I'm hoping someone here would know. (Clarification: I'm doing a silent install for distribution to multiple machines, so I'm

Setting and getting variables in .Net hosted IronPython script

丶灬走出姿态 提交于 2019-12-21 19:41:39
问题 I'm trying to prototype a validation rules engine using IronPython hosted in a .Net console application. I've stripped the script right down to what I believe is the basics var engine = Python.CreateEngine(); engine.Execute("from System import *"); engine.Runtime.Globals.SetVariable("property_value", "TB Test"); engine.Runtime.Globals.SetVariable("result", true); var sourceScope = engine.CreateScriptSourceFromString("result = property_value != None and len(property_value) >= 3"); sourceScope