[IronPython] CallTarget0 problem

Kent Johnson kent37 at tds.net
Thu Jun 4 19:42:41 CEST 2009


Hi,

I am an IPy newbie, trying to run example 7.17 from IronPython in
Action. It includes the code

delegate = CallTarget0(something.form.Close)
something.form.Invoke(delegate)

were something.form is a Windows.Forms.Form object. The first line
above gives this error:
Traceback (most recent call last):

  File "C:\Project\MangoTest\src\SmokeTest.py", line 43, in
C:\Project\MangoTest\src\SmokeTest.py

  File "mscorlib", line unknown, in CreateDelegate

ValueError: Error binding to target method.

If I change the first line to
  delegate = CallTarget0(lambda: something.form.Close())
it works fine.

Does the argument to CallTarget0() have to be a Python function? Or,
what is going on here?

I'm running IronPython 2.0.1 on Win XP with .NET 3.5.

Thanks,
Kent



More information about the Ironpython-users mailing list