ironpython

deepcopy in IronPython

I want to do a deepcopy in IronPython, but when I write import copy I get "no module named copy". How do I deepcopy in IronPython? ...

Cant add events for controls in WPF IronPython VS2010

I installed VS2010 and IronPython tools. When I start a VB.NET WPFProject everything works fine. But when I start a WPF IronPython project, it creates a button by default which fills all the window, and when you try to add an event to that control or another control dragged from the toolbox, you just cant do it. You double click on them,...

Using SQL Alchemy and pyodbc with IronPython 2.6.1

I'm using IronPython and the clr module to retrieve SQL Server information via SMO. I'd like to retrieve/store this data in a SQL Server database using SQL Alchemy, but am having some trouble loading the pyodbc module. Here's the setup: IronPython 2.6.1 (installed at D:\Program Files\IronPython) CPython 2.6.5 (installed at D:\Python26...

Mimicking basic fcntl or SetHandleInformation call in .Net

Tornado enables win32 support by faking Python's fcntl function using SetHandleInformation, which is available via ctypes on Windows. After some other small fixes, this actually works using IronPython on Windows as well (sadly, IronPython is five times slower). I'd like to get Tornado working on any CLI platform, such using Mono on O...

C# / IronPython Interop and the "float" data type

Working on a project that uses some IronPython scripts to as plug-ins, that utilize functionality coded in C#. In one of my C# classes, I have a property that is of type: Dictionary<int, float> I set the value of that property from the IronPython code, like this: mc = MyClass() mc.ValueDictionary = Dictionary[int, float]({1:0.0, 2:0...

C# / IronPython Interop with shared C# Class Library

I'm trying to use IronPython as an intermediary between a C# GUI and some C# libraries, so that it can be scripted post compile time. I have a Class library DLL that is used by both the GUI and the python and is something along the lines of this: namespace MyLib { public class MyClass { public string Name { get; set; } ...

How do I do import hooks in IronPython/Silverlight?

I'm extending TryPython to (along with various other things) allow users to save a file and subsequently import that file. TryPython overloads the built in file operations, so I need to know what parts of import need to hooked into in order for import to use the overloaded file operations. Really, a basic overview of IronPython's impor...

Running IronPython Script in C# Asynchronously

In C# 4.0 and IronPython 2.6, is it possible to execute a python script in it's own thread? I would like to spawn off the script after passing in some event handler objects so that it can update the GUI as it runs. ...

Finding new IP in a file

Hello. I have a file of IP addresses called "IPs". When I parse a new IP from my logs, I'd like to see if the new IP is already in file IPs, before I add it. I know how to add the new IP to the file, but I'm having trouble seeing if the new IP is already in the file. !/usr/bin/python from IPy import IP IP = IP('192.168.1.2') #f=open(IP(...

Convert between python array and .NET Array

I have a python method that returns a Python byte array.array('c'). Now, I want to copy this array using System.Runtime.InteropServices.Marshal.Copy. This method however expects a .NET array. import array from System.Runtime.InteropServices import Marshal bytes = array.array('c') bytes.append('a') bytes.append('b') bytes.append('c') M...

PySerial and IronPython - get strange error

I have a device connected to COM31. And the code that I need to create a serial connection looks very simple port = 31 trex_serial = serial.Serial(port - 1, baudrate=19200, stopbits=serial.STOPBITS_ONE, timeout=1) The foollowing code works when I run it using Python2.6, but when executed by IronPython2.6.1, this is what I get: Traceb...

How to convert raw_input() into a directory?

Hi everyone, I just picked up IronPython and I've been trying to get this IronPython script going but I'm stuck at trying to get a Path input from raw_input to be a directory path. The first block of code is the broken one that I'm working on. import System from System import * from System.IO import * from System.Diagnostics import * ...

How to call IronPython function from C#/F#?

This is kind of follow up questions of http://stackoverflow.com/questions/2969194/integration-of-c-f-ironpython-and-ironruby In order to use C/C++ function from Python, SWIG is the easiest solution. The reverse way is also possible with Python C API, for example, if we have a python function as follows def add(x,y): return (x + 10...

How can I insert an ironpython console into my form?

I want to make a winform by C#, and add a ironpython console window in it, like a multiline textbox. So I can write python program into it to do some operations in my Winform software. How can I do that? Thanks. affixture: I created a opensource project IpyIF, Ironpython Interactive Window.http://ipyiw.codeplex.com/ ...

How can I redirect the stdout of ironpython in C#?

public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button3_Click(object sender, EventArgs e) { try { var strExpression = @" import sys sys.stdout=my.write print 'ABC' "; var engine = Python.CreateEngine...

Linking IronPython to WPF

I just installed VS2010 and the great new IronPython Tools extension. Currently this extension doesn't yet generate event handlers in code upon double-clicking wpf visual controls. Is there anyone that can provide or point me to an example as to how to code wpf event handlers manually in python. I've had no luck finding any and I am new ...

Ironpython call numpy problem

Ironpython 2.6, python 2.6.5, numpy, SciPy import sys sys.path.append(r'D:\Python26\dll') sys.path.append(r'D:\Python26\Lib') sys.path.append(r'D:\Python26\Lib\site-packages') » import numpy Traceback (most recent call last): File "", line 1, in File "D:\Python26\Lib\site-packages\numpy\__init__.py", line 132, in File "D:\Pyth...

MySQL + Python (IronPython) timeout problem

I'm querying MS SQL using python using the source code from http://www.ironpython.info/index.php/Accessing_SQL_Server: import clr clr.AddReference('System.Data') from System.Data import * TheConnection = SqlClient.SqlConnection ("server=yourserver;database=News;uid=sa;password=password;timeout=0") TheConnection.Open() MyAction = SqlCl...

Looking for example code to create an IronPython HTTPModule

Can someone point me to some skeleton code for creating and wiring up a HTTPModule built in ironPython? ...

How to replace the blank

Given the code: import clr clr.AddReference('System') from System.Text.RegularExpressions import * def ReplaceBlank(st): return Regex.Replace( st,r'[^a-z\s](\s+)[^a-z\s]', lambda s:s.Value.Replace(' ', ''),RegexOptions.IgnoreCase) I expect the input ABC EDF to return ABCDEF but it doesn't work, what did I do wron...