Tagged Questions
3
votes
2answers
1k views
IronPython - JSON choices
What is the best way to deal with JSON in IronPython 2.0.1. The native Python "standard library" json looks to be not implemented yet.
If I wanted to use the Newtonsoft Json.NET library how do I do ...
0
votes
1answer
40 views
Invoking IronPython function from C# after IronPython runtime was disposed
Suppose we have the following code in IronPython:
def hello():
print "Hello from Python"
We call function hello() in the following C# code:
private static void GetPythonFunction()
{
...
27
votes
1answer
1k views
Ambigious reference for ExtensionAttribute when using Iron Python in Asp.Net
I get the following error when starting an Asp.Net site that uses an assembly that in turn makes use of the dlr and Iron Python for scripting.
BC30560: 'ExtensionAttribute' is ambiguous in the ...
3
votes
0answers
983 views
how to declare a byte[] in C# so that ironpython interprets it as byte[] and not as a tuple [closed]
In a C++/CLI we have a function that returns this:
array<Byte>^ OutBuffer = gcnew array<Byte>(BufferSize);
IronPython treats it as a byte[].
In C#, we have a function that returns ...
1
vote
1answer
86 views
Intercepting method invocation to c# objects
I have an hybrid c# object, with some instance properties and methods, and I pass it to IronPython. What I want is to syncronize the dispatch to the c# members, both static and dynamics, from Py code.
...
0
votes
0answers
25 views
How do I have one IronPython script import another when both are stored as strings in memory?
I'd like to be able to load two IronPython scripts and have one reference the other without having a reliance on the scripts being physically present on disk. Is this possible? (What I'm doing is ...
8
votes
3answers
3k views
Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host?
Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host?
After some quick tinkering, right now I'm leaning towards powershell for two main reasons (note ...
1
vote
1answer
603 views
DLR & Performance
I'm intending to create a web service which performs a large number of manually-specified calculations as fast as possible, and have been exploring the use of DLR.
Sorry if this is long but feel free ...
2
votes
3answers
713 views
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 ...
2
votes
2answers
398 views
IronPython and DynamicObject that overrides TryUnaryOperation
IronPython (2.7.3) seems to not check the TryUnaryOperation with ExpressionType.IsFalse and ExpressionType.IsTrue for performing short-circuit evaluation of the logical AND and OR operations.
Here's ...
-2
votes
2answers
188 views
IronPython and Javascript execution via C# isn't consistent? [duplicate]
Possible Duplicate:
Is JavaScript’s Math broken?
I wrote some simple C# code that runs Python code dynamically (already implemented):
string code = @"100 * 2 + 4 / 3";
ScriptEngine engine ...
1
vote
1answer
103 views
DapperDotNet w/IronPython: How To Handle Returned Result Set?
Tried to throw a quick example together this morning but I ran into a road block. Everything works fine up to the point when I want to do something with the result set returned. Dapper is returning ...
2
votes
1answer
304 views
How to get IDynamicMetaObjectProvider for a static (compile time) type?
I want to execute dynamic expressions (provided by the user) in the context/scope of a compile time type.
In the example below, context is an instance of an arbitrary compile time type. To create the ...
4
votes
6answers
1k views
Which Dynamic .NET language makes more sense to learn, Iron Ruby or Iron Python?
I'd like to take some time to learn more about dynamic languages built on top of the DLR and I'm not sure which language would be better to learn.
Having limited time, I really only have time to look ...
1
vote
1answer
401 views
Analyzing an IronPython Scope
I'm trying to write C# code with an embedded IronPython script. Then want to analyze the contents of the script, i.e. list all variables, functions, class and their members/methods.
There's an easy ...
0
votes
1answer
94 views
How to get a runtime context, when exection a script on the DLR scripting host?
Currently I'm working in a case study to integrate IronRuby into one of our core products.
The exection of scripts in only possible in a synchronous manner, so I plan to execute the scripts in threads ...
1
vote
2answers
586 views
Calling PythonFunction's from a VB application hosting Iron Python
I'm a C++ programming who was tapped to write a small application in Visual Basic. The application hosts an IronPython runtime and I am attempting to define some function in python and then call them ...
1
vote
1answer
100 views
Import a DLRCachedCode class in a IronPython Script
I'm trying to understand how to import in a IronPython script a dll generated with pyc.py.
Is it possible ?
Posts all around speak about to use a DLRCachedCode class by C#, instead , I would to ...
3
votes
2answers
279 views
Calling a function with named arguments in a hosted application
So I am hosting IronPython in my C# application. IronPhyton is used to implement a DSL for users. The DSL syntax should be something like this:
Ping(Message = "testOne1")
The hosting code looks ...
2
votes
0answers
515 views
C# application works much slower using compiled IronPython standard library
When I load modules from standard library as source .py files in this application, elapsed time after end equals approximately 4 seconds:
Stopwatch watch = Stopwatch.StartNew();
ScriptEngine engine = ...
5
votes
1answer
299 views
What happens when import a module in ironpython?
In CPython, I think, import means compile the py file to a pyc file and execute the file in the current frame, and the next time CPython will load the pyc file directly without compiling again. What ...
3
votes
1answer
534 views
Why is calling CompiledCode.Execute from C# for an IronPython script not behaving as expected
I am trying to call an IronPython (2.7.1) script from C# (4.0)
This is related to IronPython integration in C#: a specific problem/question
I have a python script like below in a file script.py
...
4
votes
2answers
781 views
Performance of Mass-Evaluating Expressions in IronPython
In an C#-4.0 application, I have a Dictionary of strongly typed ILists having the same length - a dynamically strongly typed column based table.
I want the user to provide one or more ...
0
votes
1answer
353 views
How to get a DLR representation from C#?
Is there a generic method of converting a Dynamic Language Runtime (DLR) object into a string representation? For example, here is an example where obj is checked for a couple of specific types ...
3
votes
1answer
621 views
How to refer self-contained C# class library project with IronPython inside (Visual Studio 2010)
This question is kind of lengthy but I try to provide you with the details that I think is necessary to find the answer.
I have a C# WPF solution (.Net 4) consisting of a main project, building a WPF ...
7
votes
2answers
995 views
IronPython - Editor for end-user
We're currently investigating how we can embed IronPython (scripting) into our C# application.
We see the benefits it will provide to our end users, giving them the ability to hook into our ...
2
votes
1answer
246 views
Distrubuting DLR runtime for C# Application with embedded (hosted) IronPython
We're building a commercial (closed/proprietary) intranet application which makes used of hosted IronPython (2.7), targeting .NET 4.0.
What approach would you recommend for ensuring the DLR ...
7
votes
3answers
445 views
Making the Case for IronRuby and IronPython
I guess everyone has already heard the news about some key developers leaving the Dynamic Languages team due to what they perceive as waning support for Dynamic Languages at Microsoft.
I'm quite fond ...
4
votes
3answers
484 views
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();
...
10
votes
2answers
4k views
IronPython invocation from C# (with SciPy) fails with ImportException: “No module named mtrand”
I have a python library I am trying to use via IronPython (v2.7 RC1 [2.7.0.30]) invocation from C# application. The library uses NumPy and SciPy quite extensively, which does work with SciPy and NumPy ...
11
votes
3answers
612 views
Are the “Iron” languages ready for prime time?
Is it okay to start using Iron Ruby and Iron Python in production systems? Also, are there any additional requirements for hosting them?
And, for the bonus points, given that F# is a functional ...
1
vote
2answers
228 views
Ironpython and future statements
I am using IronPython as a math parser with the DLR in my Silverlight project: it works, but computes incorrect results in cases involving division, as it uses integer instead of floating point math ...
4
votes
1answer
234 views
Is it possible to use IronPython and IronRuby side by side in the same Application?
I get a warning in Visual Studio when I reference the latest version of Microsoft.Scripting (the one included with IronPython).
Is it possible to deploy / use them side by side in the same ...
1
vote
1answer
510 views
Embedding both IronRuby and IronPython
I am trying to run both ironruby and ironpython at the sample application.
I am getting an exception -
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has
been thrown by ...
1
vote
1answer
740 views
IronPython Microsoft.Scripting Exception
I am trying to run IronPython code with c#.
I created a simple console application (.net 4) and added IronPython.dll , IronPython.Modules.dll and Microsoft.Scripting and wrote the next code -
using ...
1
vote
1answer
271 views
Get CodeExpression from string of python using IronPython?
I'm trying to get a CodeExpression from a string of python. It seems possible since some of the DLR docs mention CodeDom classes but I haven't been able to find any examples or better docs. Any ...
5
votes
1answer
314 views
.NET DLR safe or sandboxed script
I am using the DLR within a small part of a larger C# project, IronPython being the language in question.
For some parts of the system the user is able to enter a small script to customise behaviour ...
1
vote
1answer
472 views
IronPython import performance with compiled code
I am doing some experiments with IronPython 2.6.1 and the clr.CompileModules function to compile my large scripts into assemblies. Testing has shown good cold start performance performance ...
2
votes
1answer
570 views
Delegating dynamic object resolution to other instances
I'm currently hosting IronPython in a .NET 2.0 application.
I want to create a class (in C#) whose instances can be "extended" by plugin instances. That means, each member access which is ...
1
vote
2answers
1k views
IronPython DLR; passing parameters to compiled code?
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");
...
4
votes
12answers
2k views
Iron Python : what are good uses for Iron Python
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a ...
0
votes
2answers
661 views
Why do I get this .NET error - “TypeError: expected List[DataPoint], got List[DataPoint]”
I refactored some code, and now I get this error when calling a function. But everything seems to be fine, I even compared failing_argument.GetType().AssemblyQualifiedName between the old and the new ...
4
votes
2answers
514 views
The DLR, Boo, and the JVM
I'm just starting to try to learn more about the .Net VM underpinnings, and am immediately thrown off by something. I know there's this new thing called the DLR that allows for all the dynamic stuff ...
0
votes
1answer
470 views
Having trouble importing C# interface into Python
I've been doing a bunch of searching and reading today, and haven't figured out the right way to implement something, or even determining if it's possible.
Here's the gist of what I'm attempting ...
1
vote
1answer
189 views
DLR: IAttributesCollection deprecated?
In my code I've been making functions like:
public void Foo([ParamsDictionary] IAttributesCollection kwargs) {}
But I got curious. What all implements that interface? So I pulled down the ...
0
votes
1answer
278 views
Failing to import external scripts using in IronPython DLR in the browser
I am trying to use IronPython in the browser and attempting to import external python scripts:
<script src="http://gestalt.ironpython.net/dlr-latest.js" type="text/javascript">
</script>
...
2
votes
1answer
130 views
IronPython: Will this leak memory?
I’ve got a massive memory leak in my program. This is the first time I’ve used IronPython in a tight loop, so I’m wondering if this could be the cause.
For Each column In m_Columns
Dim rawValue ...
1
vote
1answer
1k views
Running IronPython object from C# with dynamic keyword
I have the following IronPython code.
class Hello:
def __init__(self):
pass
def add(self, x, y):
return (x+y)
I could make the following C# code to use the IronPython code.
...
3
votes
1answer
604 views
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() { }
}
...
11
votes
2answers
2k views
C# 4.0: casting dynamic to static
This is an offshoot question that's related to another I asked here. I'm splitting it off because it's really a sub-question:
I'm having difficulties casting an object of type dynamic to another ...