Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

.NET OBject type error "value cannot be converted to Object" #94

Copy link
Copy link
@andygraham

Description

@andygraham
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.