ironpython

IronPython multiple modules in a single file

I have a application which reads UI layout and logic from an XML file. The logic is done using IronPython (2.x), and I have found several locations where it would be very nice to have some code reuse. My preferred way to do this would be something like the following: <Layout> <Module name="MyModule"><![CDATA[ def SayHello():...

IronPython 2.6 slower than 2.0?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using IronPython; using IronPython.Hosting; namespace EmbeddedIP2_6 { class Program { static void Main(string[] args) { var engine = Python.CreateEngine(); var ss = engine.CreateScriptSourceFromString("B"...

What do I need to program in ironpython? and what's your opinion of ironpython

I found on the internet a couple of days ago ironpython. And I would like to test it. What do I need to install on my computer to use it? Does the user need to install something extra? What IDE is the best for ironpython? I also use linux. Can Mono support it? Is it worth testing (using) ironpython? I commonly use VB.NET and C#. How is...

Error using System.ComponentModel.SortDescription from IronPython

I need to use SortDescription from IronPython. But whenever I attempt to access SortDescription from IPy, I get the following error message: AttributeError: attribute 'SortDescription' of 'namespace#' object is read-only. I'm using IronPython 2.6 (2.6.10920.0) Is there some special IPy syntax that I have to use? ...

(IronPython) Execute PythonFunction from C#

Here's the situation...I want to be able to pass a python lambda into C# method where the evaluation of the lambda should happen. when I pass in the lambda, it turns into an instance of a PythonFunction. I am stuck here as I don't know how to execute this PythonFunction. I see a "call" on this class, but I don't know where to get the Cod...

There's an example on how to use an API with Python and cURL. Is it feasable to just copy the code if I have IronPython installed and have it work?

Here's the code in question: #!/usr/bin/python import pycurl c = pycurl.Curl() values = [ ("key", "YOUR_API_KEY"), ("image", (c.FORM_FILE, "file.png"))] # OR: ("image", "http://example.com/example.jpg"))] c.setopt(c.URL, "http://imgur.com/api/upload.xml") c.setopt(c.HTTPPOST, values) c.perform() c.close() I...

cast existing Button to IPy subclass

I have a test harness that runs in an embedded IronPython engine in our C# app. Some of the tests are UI automation that simulate button clicks, etc. # assume code to find an existing button, 'b' is an instance of System.Windows.Forms.Button b.OnClick(EventArgs()) The issue I have is that the above code works on IPy 2.0.2 and not o...

Cython for IronPython

Is there something equivalent to Cython for IronPython? That is, a way to compile simple functions using type annotations to increase performance? I know one of the benefits of IronPython is the ability to quickly write functions in something like C# or F# and then import them, but this can be somewhat of a burden for users who are onl...

how to avoid storing different type of objects in the same place when they represent the same but with a different data structure

This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible. I'm creating some classes to simplify some tasks for some specific requirements we have in some projects at work. I ...

Python - test a property throws exception.

Given: def test_to_check_exception_is_thrown(self): # Arrange c = Class() # Act and Assert self.failUnlessRaises(NameError, c.do_something) If do_something throws an exception the test passes. But I have a property, and when I replace c.do_something with c.name = "Name" I get an error about my Test Module not being im...

Assembly redirection in code instead of app.config

I'm using ironruby to execute a script that loads an assembly with a dependency that needs to be redirected from v2.0.0.0 to v3.5.0.0 in the app.config like this: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b...

Streaming Ironpython output to my editor

We embed ironpython in our app sob that scripts can be executed in the context of our application. I use Python.CreateEngine() and ScriptScope.Execute() to execute python scripts. We have out own editor(written in C#) that can load ironpython scripts and run it. There are 2 problems I need to solve. If I have a print statement in ir...

Does IronPython and Jython have the same GIL issues as CPython?

Hi! I read about the problems with CPython and CPU bound threads and the GIL and some changes in Python 3.2. Do IronPython and Jython have this same problem? Thanks ...

Ironpython string replace on 16-bit unicode character

In 2.6.4, is there a reason I can't do: "my string".replace(u'\u200E', '') without getting an index exception? This looks like a bug in IronPython but I'm not sure... ...

Python extensions that can be used in all varieties of python (jython / IronPython / etc.)

In the 'old days' when there was just cpython, most extensions were written in c (as platform independent as possible) and compiled into pyd's (think PyCrypto for example). Now there is Jython, IronPython and PyPy and the pyd’s do not work with any of them (Ironclad aside). It seems they all support ctypes and that the best approach MI...

What are the benefits of using IronPython over IronRuby or F#?

Well aware that DLR is here!! I have recently reading up on all of these and was wondering if there were any specific benefits of using one language over another? For example performance benefits! and available functionality through standard libaries!! ...

Running django on IronPython

There have been some questions and answers here on stackoverflow, but no one asked if it's a good solution to run django on IIS. Any experience is welcome, both good and bad. ...

IronPython: String is null or empty

Ok, here are some easy points. PyBinding came with this script: def IsNotNull(value): return value is not None It is close, but what I want is this. bool IsNotNullOrEmpty(string value) { return (value != null) && (value.Length > 0 ); } EDIT WTF? Someone gives the right answer "return value is not None and len(value) > 0", ...

how to declare a byte[] in C# so that ironpython interprets it as byte[] and not as a tuple

In a C++/CLI we have a function that returns this: array^ OutBuffer = gcnew array(BufferSize); IronPython treats it as a byte[]. In C#, we have a funtion that returns this: OutBuffer = new Byte[InBuffer.Length]; While a C# client treats Outbuffer as a byte[], IronPython treats it as a tuple containing multiple arrays. How do we mak...

Build Python scripts and call methods from C#

Is there any way to make this scenario work? There is a Python script. It is built into a DLL by running this script with IronPython: import clr clr.CompileModules("CompiledScript.dll", "script.py") The goal is to call this DLL's methods from C# code. .NET Reflector shows there is one class in the DLL - DLRCashedCode and the methods ...