Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Error in bind python function with C#'s delegate #1507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GentlerMan opened this issue Aug 5, 2021 · 2 comments
Closed

Error in bind python function with C#'s delegate #1507

GentlerMan opened this issue Aug 5, 2021 · 2 comments

Comments

@GentlerMan
Copy link

GentlerMan commented Aug 5, 2021

Environment

  • Pythonnet version:2.5.2
  • Python version:3.8
  • Operating System:win10
  • .NET Runtime:4.7.2

Details

I want to bind python function with C#'s delegate method in winform
  • C# Code
public delegate string CallBackFunc(string content);
using (Py.GIL())
  {
      using (PyScope scope = Py.CreateScope())
      {
          scope.Set("main", this);
          scope.Exec(pycode);
      }
  }
  • Python Code
def test(input):
   return "OK"
res = main.CallBackFunc(test)

When I test in program ,GET the Error Infomation:Type was not found "System. Reflection. Emit. TypeBuilder" on the constructor,
What should I do For this?

@filmor
Copy link
Member

filmor commented Aug 9, 2021

  1. This is not a support forum, it is not an adequate answer to me closing your ticket "System.Reflection.Emit.TypeBuilder" Error #1505 to just open a new one
  2. Does this also happen with the current master branch?

@GentlerMan
Copy link
Author

GentlerMan commented Aug 9, 2021

@filmor
1.Thank you for attention, Because of the lack of relevant information about delegate, I have been beseted with this problem for several days, I just found some solutions ,such as #1471,but it's no helpful for this.
2.I just test the newest release (Ver. 2.5.2), I am not sure whether this also happen with other version.

@pythonnet pythonnet locked and limited conversation to collaborators Jan 28, 2022
@filmor filmor converted this issue into discussion #1685 Jan 28, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants