Thursday, 1 June 2023

pythonnet clr: how to get the signature of a function/method?

When importing a .NET library in Python with:

import clr
clr.AddReference(r"C:\foo.dll")
from foo import *

my_foo = Foo()
print(my_foo.my_method)
# <bound method 'my_method'>

I'd like to know the signature of the function (its parameters). This doesn't work:

from inspect import signature
print(signature(my_foo.my_method))

It fails with:

ValueError: callable <bound method 'GroupStatusGet'> is not supported by signature

Question: how to get the signature of a function on Python + .NET ?



from pythonnet clr: how to get the signature of a function/method?

No comments:

Post a Comment