8000 .NET OBject type error "value cannot be converted to Object" · Issue #94 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content
.NET OBject type error "value cannot be converted to Object" #94
Closed
@andygraham

Description

@andygraham

Using Cpython 2.7.10 and pythonnet-2.1.0.dev1

I may be missing something as I am an IronPython user just playing to see if my Windows Forms code can run on CPython and PythonNet.

To fully use Windows Forms with PythonNet it is convenient, even necessary at times, to treat any Python object as a .NET Object so that it can be passed as a parameter to a delegate. For example to invoke a Python function to run on a WinForms GUI thread from a different thread you need to use Control.BeginInvoke which takes an Object array for the method parameters. There is no need to access these objects from .NET code, merely to package and unpackage them as .NET Object types which IronPython has no trouble doing. An example of this failure

import clr, sys
from System import Object, Array
a = Array[Object]([sys]) ; print a[0]
TypeError: cannot convert value to Object

I was actually interested in passing frame objects which have the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0