[Python.NET] System.InvalidOperationException: Handle is notinitialized

Maksim Kozyarchuk mkozyarchuk at hedgeserv.com
Fri Apr 24 20:33:57 CEST 2009


Ethan,
    I believe [] syntax is meant for generics.  To create string s =
System.String(³some string²) should work.

Maksim


On 4/24/09 2:34 PM, "Ethan Adler" <ewadler at gmail.com> wrote:

> Anyone getting the following problem when running the current version
> of python.net <http://python.net>  with python2.6?
> 
> 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.
> 
> thanks,
> -Ethan
> 
> 
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20090424/f265563f/attachment.htm>


More information about the PythonDotNet mailing list