1

I am working on a project where the applications use python and PyQt for front-end, and the backend is written in C#. I defined a method in C#:

public void methodA(int param1, int param2=0,int param3=5){
    // some code
}

But when calling it from Python using pythonnet (Python for .NET):

methodA(param1)

I get the error message: "No method matches given arguments". I understand that it has to do somehow with reflection.

My question is:
1. Is there any other way except: calling the method( in Python) like this: methodA(param1,0,5) or using reflection
2. If not, what needs to be done to enable this to work via reflection.

EDIT: the difference between the questions is that I can pass the values for my optional parameters, and the function call will work, but if I try to call methodA with one parameter it will not. This is the first failing example in the linked question. The reason why I don't want to pass the default value for the parameters all the time is because we have over 300 calls to that function.

limbo
  • 684
  • 9
  • 18
  • 2
    There are few solutions listed here: http://stackoverflow.com/questions/26742837/creating-a-c-sharp-nullable-int32-within-python-using-python-net-to-call-a-c-s – denfromufa Aug 18 '16 at 04:20

0 Answers0