ironpython

IronPython on ASP.NET MVC

こ雲淡風輕ζ 提交于 2019-12-02 15:52:48
Has anyone tried ASP.NET MVC using IronPython? Having done a lot of Python development recently, it would be nice to continue with the language as I go into a potential ASP.NET MVC project. I'm especially interested in exploiting the dynamic aspects of Python with .NET features such as LINQ and want to know if this will be possible. The other route that may be viable for certain dynamic programming would be C# 4.0 with its dynamic keyword. Thoughts, experiences? Yes, there is an MVC example from the DLR team . You might also be interested in Spark . Using IronPython in ASP.NET MVC: http://www

IronPython integration with C#/ .NET

旧街凉风 提交于 2019-12-02 12:38:26
So I'm trying to develop this application that will get a captcha image from an website and try to decode it so I can fill the captcha input text with the resulted text after I decode the picture. I want to use the solution I found here: http://www.wausita.com/captcha/ So, before trying to integrate it in my main application I tried to integrate it in a simple console application: using System; using System.Collections.Generic; using System.Linq; using System.Text; using IronPython.Hosting; using Microsoft.Scripting.Hosting; namespace Python { class Program { static void Main(string[] args) {

Reading the contents of Microsoft Visio (2010) doc in IronPython

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 09:32:11
I have an assignment to write a program in IronPython, that reads a Visio (2010) Document, and outputs in CMD what objects are in the active page, and how they are connected to each other. So far, I have managed to open the Visio Document, but I can't display what's in it. This is my code until now: import sys import clr import System clr.AddReference("Microsoft.Office.Interop.Visio") import Microsoft.Office.Interop.Visio IVisio = Microsoft.Office.Interop.Visio visapp = IVisio.ApplicationClass() doc = visapp.Documents.Open("C:\\Users\\hari\\Desktop\\PythonExamples\\helloworld.vsd") page =

IronPython DLR; passing parameters to compiled code?

半腔热情 提交于 2019-12-02 03:34:04
问题 I'm currently doing the following to create and execute a simple python calculation, using DLR: ScriptRuntime runtime = Python.CreateRuntime(); ScriptEngine engine = runtime.GetEngine("py"); MemoryStream ms = new MemoryStream(); runtime.IO.SetOutput(ms, new StreamWriter(ms)); ScriptSource ss = engine.CreateScriptSourceFromString("print 1+1", SourceCodeKind.InteractiveCode); CompiledCode cc = ss.Compile(); cc.Execute(); int length = (int)ms.Length; Byte[] bytes = new Byte[length]; ms.Seek(0,

IronPython DLR; passing parameters to compiled code?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 03:23:21
I'm currently doing the following to create and execute a simple python calculation, using DLR: ScriptRuntime runtime = Python.CreateRuntime(); ScriptEngine engine = runtime.GetEngine("py"); MemoryStream ms = new MemoryStream(); runtime.IO.SetOutput(ms, new StreamWriter(ms)); ScriptSource ss = engine.CreateScriptSourceFromString("print 1+1", SourceCodeKind.InteractiveCode); CompiledCode cc = ss.Compile(); cc.Execute(); int length = (int)ms.Length; Byte[] bytes = new Byte[length]; ms.Seek(0, SeekOrigin.Begin); ms.Read(bytes, 0, (int)ms.Length); string result = Encoding.GetEncoding("utf-8")

Working with PTVS, IronPython and MongoDB

一世执手 提交于 2019-12-02 01:31:42
I want to develop an applocation using the PTVS (Python Tools for Visual Studio) and i download the PTVS pluging and IronPython for Visual Studio 2012, it works perfectly. My question here is, Can i use MongoDB with PTVS and ItonPython? If i can, how can i do it? I already tried to install it by clicking on Install Python Package , but every time ask me to install pip and fails on install. Then of course the command pip install pymongo fails because pip is not installed. Here is the error: Installing 'pip' package manager. Downloading setuptools from https://go.microsoft.com/fwlink/?LinkId

Animating Data Changes in Tibco Spotfire

与世无争的帅哥 提交于 2019-12-02 00:23:25
This is my first post here, so please forgive me if I fail at etiquette somewhere along the way. I am working on a POC dealing with animating a visualization within Tibco Spotfire 7.0 which will allow a user to see changes in data over time by iterating through a set of filters or by iterating through alterations to the data based on a pre-determined set of conditions. TIBCOmmunity already defines a custom tool for this purpose http://tibcoanalytics.com/spotfire/archive/totw/2011-01-16.html . However, it is my task to show that this can be done within an Iron Python script. The POC is rather

Initialize C# List<T> from IronPython?

喜欢而已 提交于 2019-12-01 23:52:17
问题 I have a relatively deep object tree in C# that needs to be initialized from IronPython. I'm new to python and I'm struggling with the initialization of arrays. So as an example - say I have these classes in C# public class Class1 { public string Foo {get;set;} } public class Class2 { List<Class1> ClassOnes {get;set;} } I can initialize the array in Class2 like so: var class2 = new Class2( ClassOnes = new List<Class1>() { new Class1(Foo="bar") }); In IronPython - I was trying this: bar =

Issue with using a .net class in ironpython

元气小坏坏 提交于 2019-12-01 22:31:14
问题 If I have a .Net class that is not part of any namespace then I'm not able to use it in ironpython. Here is an example Suppose I have a assembly FooLib.dll with the following class definition //note the following class is not part of global namespace public class Foo { } Now I try to use it in ironpython clr.AddReference("FooLib") # This call succeeds. f = Foo() The line f= Foo() returns the error Traceback (most recent call last): File "", line 1, in NameError: name 'Foo' is not defined I

Looping over a Python / IronPython Object Methods

こ雲淡風輕ζ 提交于 2019-12-01 21:28:35
问题 What is the proper way to loop over a Python object's methods and call them? Given the object: class SomeTest(): def something1(self): print "something 1" def something2(self): print "something 2" 回答1: You can use the inspect module to get class (or instance) members: >>> class C(object): ... a = 'blah' ... def b(self): ... pass ... ... >>> c = C() >>> inspect.getmembers(c, inspect.ismethod) [('b', <bound method C.b of <__main__.C object at 0x100498250>>)] getmembers() returns a list of