[IronPython] IronPython and C# not giving the same result

2010-06-15 Thread yngipy hernan
Hi All, I have tried to transliterate the following C# code to IronPython: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Automation; namespace ConsoleApplication1 { class Program { static void Main(string[] args)

Re: [IronPython] Convert between python array and .NET Array

2010-06-15 Thread Marcel
Ok, it's clear now. Thanks for the great support! -- Marcel On Jun 15, 9:21 pm, Dino Viehland wrote: > Marcel wrote: > > Thanks Dino, the ctypes.memmove does work! > > > I wasn't aware that ctypes could be used in IronPython. Do they > > marshal to unmanaged code under the hood? > > There's not

Re: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2)

2010-06-15 Thread yngipy hernan
Hi Dino, Thanks for being patient. I think you are right. It is actually working, I am just not used to seeing "expected" exceptions. By the way, where can I find ipy.pdb (I am assuming that it is the file that "Cannot find or open the PDB file" points to as shown in debug session)? Regards, Yng

Re: [IronPython] Convert between python array and .NET Array

2010-06-15 Thread Curt Hagenlocher
On Tue, Jun 15, 2010 at 9:21 PM, Dino Viehland wrote: > > For the 2 IntPtr cases there's no overloads on Marshal and I don't believe > anywhere in .NET. Yes, this is my mistake. I think I saw the [IntPtr[], int, IntPtr, int] overload and mentally elided the first array specifier. -Curt _

Re: [IronPython] Convert between python array and .NET Array

2010-06-15 Thread Dino Viehland
Marcel wrote: > Thanks Dino, the ctypes.memmove does work! > > I wasn't aware that ctypes could be used in IronPython. Do they > marshal to unmanaged code under the hood? There's not really any unmanaged code on *our* side involved at all. It all turns into .NET's support for interop. So we'll

Re: [IronPython] Convert between python array and .NET Array

2010-06-15 Thread Marcel
Thanks Dino, the ctypes.memmove does work! I wasn't aware that ctypes could be used in IronPython. Do they marshal to unmanaged code under the hood? Let me know if you want me to file a bug against the Marshal.Copy overload behavior. Thanks, -- Marcel On Jun 15, 11:42 am, Dino Viehland wrote:

Re: [IronPython] Convert between python array and .NET Array

2010-06-15 Thread Dino Viehland
Can I make a different recommendation? Rather than doing a Marshal.Copy you could use ctypes.memmove. That would look like: import ctypes ctypes.memmove(bmData.Scan0, bytes.buffer_info()[0], total_bytes) If Scan0 is actually an IntPtr youa may need to do a .ToInt32() or .ToInt64() on it (I don'

Re: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2)

2010-06-15 Thread Dino Viehland
Ok it looks like the last exception is a normal exception from startup. So the interesting question I guess is what happens between startup and when your script starts? Can you set a break point on the 1st line of your script and see what happens (you can just hit F9 while on the 1st line of c