ironpython

possible to intercept and rewrite email on outlook client side using ironpython?

I want to intercept and transform some automated emails into a more readable format. I believe this is possible using VBA, but I would prefer to manipulate the text with Python. Can I create an ironpython client-side script to pre-process certain emails? EDIT: I believe this can be done with outlook rules. In Outlook 2007, you can do...

Colour map in ipython.

Hi there, I am trying to plot some data in ipy. The data consists of three variables alpha,beta and delta. The alpha and beta values are the coordinates of the data points that I wish to plot using a hammer projection. I want to scale the colour of the markers according to the delta values, preferably in a rainbow scale colormap i.e. fr...

How do I clear screen in IronPython console?

When we work with a regular windows command prompt we can clear the screen by typing cls command. How I can do the same in IronPython console (ipy)? ...

Are IronPython or IronRuby well-suited for the MVVM pattern in WPF/Silverlight?

Hi all, I've been very happily using the Model-View-ViewModel (MVVM) pattern in WPF and Silverlight apps in combination with C#. Declarative XAML markup and data binding are invaluable - I just can't live without them. But, this talk by Harry Pierson on dynamic languages got me excited about learning a dynamic language, and I'd like to ...

How to construct a PythonTuple from C#

I want to construct an IronPython tuple from C#. These are PythonTuple's public constructors: public PythonTuple(); public PythonTuple(object o); How would I construct, for example, the tuple (1, 2, 3)? ...

Getting traceback information from IronPython exceptions

I have IronPython hosted within my application, whenever I catch an exception thrown from a script, I get unhelpful gibberish like this: IronPython.NewTypes.System.Exception_1$1: Error occurred during conversion ---> Microsoft.Scripting.ArgumentTypeException: expected int, got DispMethod at _stub_$245##245(Closure , CallSite , Object...

Where to look up names of .NET assemblies that contain a class or namespace?

In .NET scripting languages such as PowerShell and IronPython, when you want to use a .NET class you typically need to import the assembly name. Is there a quick way to find this information? E.g. if I want to use System.Net.Mail, how do I quickly find out which assembly its in? I'm not necessarily looking for a programmatic way, even...

Can't use DateTime in IronPython

Howdy gents, I'm hosting my IronPython in a C# webapp like so: var engine = Python.CreateEngine(); var scope = engine.CreateScope(); var script = Engine.CreateScriptSourceFromString(pythonCode, SourceCodeKind.Statements); script.Execute(scope); And my python code looks like this: import clr clr.AddReference('System.Core') from Syst...

IronPython - How to prevent CLR (and other modules) from being imported

I'm setting up a web application to use IronPython for scripting various user actions and I'll be exposing various business objects ready for accessing by the script. I want to make it impossible for the user to import the CLR or other assemblies in order to keep the script's capabilities simple and restricted to the functionality I expo...

Using IronPython to learn the .NET framework, is this bad?

Because I'm a Python fan, I'd like to learn the .NET framework using IronPython. Would I be missing out on something? Is this in some way not recommended? EDIT: I'm pretty knowledgeable of Java ( so learning/using a new language is not a problem for me ). If needed, will I be able to use everything I learned in IronPython ( excluding la...

How to use Sphinx auto-documentation when Python file won't compile

This question is even harder today because I haven't had any luck using the search function on the Sphinx homepage today. I have a group of modules that I want to be documented from the docstrings. However, these are not pure Python scripts. They won't compile as is, because they are run from a C# application that creates a new variable...

ruby inside silverlight functionality over c#

Having just found out that you can use Ruby or Python inside a SilverLight application.. link here ..I wonder if its possible to bypass some of the SilverLight limitations with use of these languages instead of C#. I know that the Ruby Engine inside the SilverLight application is trimmed down, just as the .NET CLR is, so I would like...

IronPython: How to access trace back local variables

private ScriptEngine pe; private ScriptScope scope; private void button1_Click(object sender, EventArgs e) { pe = Python.CreateEngine(); scope = pe.CreateScope(); pe.Runtime.SetTrace(OnTraceback); pe.Execute(@" def square(x): s = x*x return s a = square(2) + (3) print ""hello world "" + str(a) ", scope); } private...

Optparse library - callback action while storing arg

My code: def main(): usage = "usage: %prog [options] arg" parser = OptionParser(usage) parser.add_option("-p", "--pending", action="callback", callback=pending, type="string", dest="test", help="View Pending Jobs") (options, args) = parser.parse_args() if x == 0: print usage, " (-h or --help for help)" print...

How do I get hold of my CodeContext in IronPython RC1?

CodeContext is used throughout IronPython. But since I moved to IronPython RC1 I cannot get hold of one. Has anyone used IronPython RC1 and managed to use ClrModule.AddReferenceByName(...) or PythonType.__getattribute__(...) Both of them take a CodeContext and hence I can no longer use them. ...

Ironpython 2.6 .py -> .exe

I already attempted using py2exe (not compatible with ipy) and PYC (out of date). Can anyone point me in the direction of a good compiler? ...

Configure External Run in PyScripter to run IronPython

Any Iron PyScripter's in da the house? I'm seeking the "External Run" parameters/variables needed to configure IronPython to run the current script. I don't understand any of variable examples, so verbatim instructions or a screen shot of how to configure the "External Tools Properties" configuration page is really what I need. Thanx!...

Issue with using a .net class in ironpython

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("Fo...

SQL DataReader in IronPython

Please help me to read just one record from MS SQL table. I tried to do that in the next way (IronPython 2.6 RC1): cmd = SqlCommand("SELECT * FROM myTable", cn) dr = cmd.ExecuteReader() After that I have ALL the table in dr! But need only ONE record (more precise: read table records one by one) ... Sorry! I was wrong! I forget abou...

How to use tabs-as-spaces in Python in Visual Studio 2008?

I have some IronPython scripts that are embedded in a C# project, and it would be convenient to be able to edit them in the VS editor. VS evidently knows about Python because it provides syntax coloring for it. Unfortunately however the editor uses tab characters for indentation, whereas I want spaces. Is there a setting to change this? ...