ironpython

How can I enable sys._getframe in IronPython 2.6.1?

Hey all, I'm trying to use a module that requires sys._getframe(), which, as I understand it, is not enabled by default. I've seen a lot of material that suggests that there is a way to enable _getframe(), but I've yet to find anything that tells me how to do so. What is the proper method for enabling this function in IronPython 2.6.1...

Python decorators that are part of a base class cannot be used to decorate member functions in inherited classes

First time poster, long time reader, so bear with me: Python decorators are fun to use, but I appear to have hit a wall due to the way arguments are passed to decorators. Here I have a decorator defined as part of a base class (the decorator will access class members hence it will require the self parameter). class SubSystem(object): ...

How to use .net reomting object in ironpython?

IUgRemoting.dll namespace test { public interface IUgRemoting { Session GetSession(); UFSession GetUFSession(); UI GetUI(); } } I test in C# var loader = (IUgRemoting)Activator.GetObject(typeof(IUgRemoting), "ipc://test/test.ShareClass"); var theSession = loader.GetSession(); ...

C# Generics with IronPython Type Parameters

So, the situation is I have a C# generic class named Foo with a template parameter T which has the new() constraint. I've declared my classes something like this: class Baz { public Baz() { } } class Foo<T> where T : Baz, new() { // blah blah } And in Python: class Bar(Baz): def __init__(self): """ do various...

Determine Declaring Order of Python/IronPython Functions

I'm trying to take a python class (in IronPython), apply it to some data and display it in a grid. The results of the functions become columns on the grid, and I would like the order of the functions to be the order of the columns. Is there a way to determine the order of python functions of a class in the order they were declared in t...

IronPython: how can I run init code when I import a module using clr.AddReference()?

Hi all, I was wondering if there was a way that you could get init code to run upon importing a .NET assembly using clr.AddReference(), in the same way that importing a python file executes the init.py code that resides in the same directory. Thanks in advance! ...

DLR Scripting within Silverlight 4 Application

I would like to add some scripting support to a Silverlight 4 application that I'm working on. I have the latest stable releases of both IronRuby and IronPython installed on my machine with Visual Studio 2010. I looked at some samples of using the ScriptEngine class with both IronRuby and IronPython. I even got it to work in a small Wind...

Is there a way to use IronPython objects and functions (compiled into an assembly) from C# code?

IronPython.net documentation says the MSIL in the assembly isn't CLS-compliant, but is there a workaround? ...

IronPython in C#: No module named xmlrpclib

I am trying to build a web application with an interactive console for IronPython. When I try to import xmlrpclib in IronPython's normal console, it works. However, if I use IronPython inside my C# code, it throws an exception "No module named xmlrpclib". Is this a known issue? Any solutions to solve this issue? Here's the code: var te...

IronPython scripts execution from C# code

Hi, I have one question, I have such code this._engine = Python.CreateEngine(); ScriptSource source = this._engine.CreateScriptSourceFromString(script.SourceCode); ScriptScope scope = this._engine.CreateScope(); ObjectOperations operations = this._engine.Operations; source.Execute(scope); And I am trying to execute IronPython code fr...

dynamic values in kwargs

I have a layer which helps me populating records from the form to tables and viceversa, it does some input checking, etc. Now several methods of this layer which are called several times in different parts of the webform take the same parameters, so I wanted to pack them at the begining of the codefile. kwargs(): return {"tabla"...

What is the best way to install IronPython on mono on mac?

What is the best way to install ironPython on mono on mac? Should I just download the binaries, ngen, and move forward? Is there any specific plug-in I need for an editor? Everyone seems to think I should just ngen the source installs and use eclipse with the ironpython plugins, but that seems quite counter to using monodevelop, and i...

IronPython function with variable number of arguments as a delegate

Hey! In IronPython I am trying to call a PythonFunction with different numbers of arguments from C#. For instance; I want to do: def foo(a, b): print a, b def bar(a, b, c = None): print a, b, c p = App.DynamicEvent() p.addHandler(foo) p.addHandler(bar) p.invoke("Not", "Working") where addHandler takes a single argument ...

Using wpf datagrid with ironpython and sqlite3

I am trying to figure out how to make use IronPython (2.6) wpf and sqlite3 (i use the Ironpython.SQLite.dll) I get somewhat stuck in how to use the wpf datagrid. Can anyone help me further in how to code in order to fill the datagrid with the data from the sqlite database thats made here. Below is the code on how far i got... 1st t...

What is the HostCodeHeap and why are they leaking?

We have .NET application (actually an IronPython app). We noticed that overtime the app becomes bigger in memory and sluggish. Using WINDBG (!eeheap -loader), we noticed the that the LoaderHeap is getting bigger (150MB increase per day). From the !eeheap output it seems that the increase is due to HostCodeHeap (objects?). I'd like to ...

IronPython & WPF: Binding a checkbox's IsChecked property to a class member variable

I've seen many similar questions on how to get data binding working with a checkbox, but all of the examples I've seen are in C# and I can't seem to make the leap to convert it to IronPython. I have a checkbox defined in a window thusly: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sc...

Problem importing System.Dynamic in IronPython

I'm obviously missing something trivial, but I can't seem to import from System.Dynamic; to wit: import clr clr.AddReference('System.Dynamic') which clearly adds the salient reference: clr.References[2] (< System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a>) but importing fails import Sy...

submodules in ironpython

Hey everyone, While I'm familiar with making .net assemblies with the PythonModule assembly attribute, I'm a little curious as to how you could make submodules. Would this be a class within a class? i.e: if I have a class defined as an IronPython module such as: [assembly: PythonModule(mymodule),typeof(namespace.mymodule)] How could...

using the VB.NET Year function from IronPython

Since it's possible using the IsNumeric() and others VB.NET functions from IronPython by importing Microsoft.VisualBasic and using it as an object method, is it possible somehow to use the Year() VB.NET function from IronPython? ...

Importing assemblies into IronPython from another assembly

I have an IronPython 2.6/2.7 script I am writing which imports a lot of assemblies. In other words, at the top of the script it does this... clr.AddReference( "System.Xml" ) import System.Xml Except it doesn't do this for 1 assembly, but for 10 assemblies. Some of the modules are built-in .NET assembllies and some are assemblies I ...