0

I am trying to invoke a .Net function from python using the Python.net module. The existing code was written on Iron Python, I am in the process of converting the code base to Python 3.X version.

Can somebody please help me with this? I am currently stuck at this point.

The C# function:

public int waitforResult (out UInt32 Elapsed_time)

{
// Code snippet
}

IronPython code:

Elapsed_time = clr.Reference[System.UInt32](10000000) - (works fine in Iron Python)

Pyton.net code:

Elapsed_time = System.UInt32(10000000)

result = waitforResult(Elapsed_time)

It seems the wait time is not being considered

Thanks, Lipun

Timus
  • 10,974
  • 5
  • 14
  • 28

1 Answers1

0

Python.NET bundles any out parameters with the return value into a tuple. So you need

result, elapsed = waitforResult()

On a similar note, this is how you call Dictionary.TryGetValue:

found, value = dict.TryGetValue(key)
LOST
  • 2,956
  • 3
  • 25
  • 40