ironpython

IronPython and Targetting to MS Framework 1.1

In IronPython Studio -> Properties -> General Tab i see a Property with Name Target Plataform and found Microsoft Framework 1.0, 1.1 and 2.0, selected 1.1 and next opened my Visual Studio 2003 -> Add Reference and for my surprise this not work. Not compatibility. Why? What i do wrong? ...

IronPython - Load script from string in C# 4.0 application

Hi, I have the following code (just a test): var engine = Python.CreateEngine(); var runtime = engine.Runtime; try { dynamic test = runtime.UseFile(@"d:\test.py"); test.SetVariable("y", 4); test.SetVariable("client", UISession.ControllerClient); test.Simple(); } catch (Exception ex) { var eo = engi...

QT4, GTK+, wxWidgets or IronPython for a native Windows app using Python

Hi there. I need to build a native windows app using Python (and py2exe, I guess). Feature requirements are: Taskbar icon Alert notifications (next to Taskbar Icon) Chromeless window (ideally a pretty, rounded, coloured one). Webkit to render some of the Chromeless window So far I've identified the following possible toolkits: pyG...

Exploring IronPython using dir() doesn't always yield results.

I'm playing around with IronPython and dir() does not always seem to work as I would expect. For instance: import clr clr.AddReference("IronPython") clr.AddReference("Microsoft.Scripting") from IronPython.Hosting import Python py = Python.CreateEngine() print dir(py.Operations) Returns: Traceback (most recent call last): TypeError: ...

How to close the input stream of an IronPython engine executing a script?

I am creating an IronPython engine more or less like so: var engine = IronPython.Hosting.Python.CreateEngine(); var scope = engine.CreateScope(); // my implementation of System.IO.Stream var stream = new ScriptOutputStream(engine); engine.Runtime.IO.SetOutput(stream, Encoding.UTF8); engine.Runtime.IO.SetErrorOutput(stre...

An example of ctypes on IronPython?

I'm trying to understand ctypes, and it's relationship to IronClad, on IronPython. (Ctypes is supposed to be implemented in the latest IronPython release.) Can somebody give a simple example of ctypes in IronPython that works on Mono/OSX? When trying the standard demos, I get: import ctypes SystemError: libdl.so Am I missing somethin...

IronPython exposing .Net type to the runtime engine

I'm looking to expose specific .Net types to the IronPython runtime. I can do this: ScriptEngine engine = Python.CreateEngine(); ScriptScope scope = engine.CreateScope(); engine.Runtime.LoadAssembly(typeof(Program).Assembly); // current assembly with types But that exposes all types to the runtime. Is selective type loading possible...

Embedding IronPython in a C# application - import error on urllib

I have a Python file with as content: import re import urllib class A(object): def __init__(self, x): self.x = x def getVal(self): return self.x def __str__(self): return "instance of A with value '%s'" % (self.getVal()) I also have a simple C# console project with the following code: engine = P...

Silverlight databinding with IronPython and Datagrid

We've been successfully using clrtype with IronPython 2.6 and Silverlight for databinding, based on the example provided by Lukás(: http://gui-at.blogspot.com/2009/11/inotifypropertychanged-and-databinding.html We create the binding when we create the datagrid columns programatically. Because we are using IronPython some of the static...

How to access WPF class library from Silverlight using iron python. Is it possible?

I'm having a class library. I'm able to access that assembly from iron python console as normal. My goal is to create a Silverlight class library which uses a python script to access that WPF class library what I'm having. Is it possible? Is there any other way to achieve this or any work around. I can provide a sample of what I'm doi...

How to atomically increment a static member in IronPython?

I have an IronPython script that uses the TPL and Parallel.ForEach to process files using multiple threads. In C# I can use Interlocked.Add and Interlocked.Increment to change global variables in an atomic thread-safe operation, but this does not work in IronPython because integers are immutable. I currently have a simple Results class t...

when a class is instantiated, storing that instance by user

hi, I have to do the following, when a class is instantiated I need to store that instance by user . Since I'm working in asp.net, I was wondering if I should use some of the ways asp.net provides to persist data between user requests. (Cache cant be because the data needs to be persistent and application state cant be because it needs...

Ironclad/Numpy import error, yet works in eclipse console.

I am trying to use numpy with ironpython. When I follow the example in the ironclad documentation, running in a console window, I get this error. C:\>ipy IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.3603 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> import ironclad >>> dir() ['__builtins_...

Using assembly attributes in F#

I'm trying to translate the following C# example, which constructs an IronPython module, to F#. using System; using IronPython.Runtime; [assembly: PythonModule("my_module", typeof(MyModule))] public static class MyModule { public static void hello_world() { Console.WriteLine("hello world"); } } Using PythonModule all...

Error in IronPython Command Line Compiler

AttributeError: attribute "CompilerSink" of "namespace#" object is read-only ...

Error in IronPython Command Line Compiler when adding reference files

this works fine ipy.exe pyc.py /main:ABMBancosPYDLL.py /target:library now this ipy.exe pyc.py /main:ABMBancosPYDLL.py /r:funciones.dll /target:library gives me the following error File pyc.py line 161 in pyc.py File pyc.py line 153 in Main SystemError:"the provided route format isnt allowed" (well sort of, I translated it ...

What Python/IronPython web development framework work on the Microsoft technology stack?

I started learning Python using the IronPython implementation. I'd like to do some web development now. I'm looking for a python web development framework that works on the Microsoft technology stack (IIS + MS SQL Server). Django looks like an interesting framework but based on what I have read, getting it to work on the Microsoft techno...

Copy ScriptScope?

Hey folks, I'm using IronPython 2.6 and I was wondering if there was a way to copy a Microsoft.Scripting.Hosting.ScriptScope to get all the variables and context in another ScriptScope. The reason I want this is I am executing a file, and I want to restore the context to before the start of the execution if an exception occurs. Thanks....

Being unable to use functions from dll file in ASP.NET IronPython

Hi, I have a file like this compiled into a dll file and placed in the bin folder 1 Imports System Imports System.Web Namespace Conexiones Public Class sql_conexiones Shared Sub consulta.. ... By doing from Conexiones import * from the .aspx.py file it works fine. I have this other file in the APP_...

What does /*!*/ signal in C# source code (as seen in the IronPython project)

Possible Duplicate: What does /!/ mean in C#? I have been poking around in the IronPython 2.6 source code and noticed that the comment /!/ appears often. Example in ArrayGlobalAllocator.cs: public ArrayGlobalAllocator(PythonContext/*!*/ context) { It doesn't seem very informative, so I guess it has a predefined (or agreed u...