Maksim, Thanks for you reply. Yes, I have tried that and it also crashes (without spitting out any errors) when I do that as well. output:
-------------Start copy from console--------------
import clr s = System.String("some string")
H:\> -------------End copy from console--------------
I think the problem has to do with the fact that python.net is optimized for python2.5, but I am trying to use it with 2.6. Is anyone using python.netwith Python 2.6. If so, can you email me any changes you made to the python.net code before compiling, and a precompiled dll to check against?
On Fri, Apr 24, 2009 at 2:33 PM, Maksim Kozyarchuk < firstname.lastname@example.org> wrote:
Ethan, I believe  syntax is meant for generics. To create string s = System.String(“some string”) should work.
On 4/24/09 2:34 PM, "Ethan Adler" email@example.com wrote:
C:\Documents and Settings\ethan>python Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import clr from System import String s = String[str]("a")
Unhandled Exception: System.InvalidOperationException: Handle is not initialized . at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value) at System.Runtime.InteropServices.GCHandle.op_Explicit(IntPtr value) at Python.Runtime.ManagedType.GetManagedObject(IntPtr ob) at Python.Runtime.Runtime.PythonArgsToTypeArray(IntPtr arg, Boolean mangleObj ects) at Python.Runtime.ClassObject.type_subscript(IntPtr idx) at Python.Runtime.MetaType.mp_subscript(IntPtr tp, IntPtr idx)
If I try s = String("a") without the [str], it doesn't even give an error, it just quits.
I spent a few minutes looking through the archives before posting, but I did not search exhaustively, so if this is a redundant post, I apologize.
Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet