w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Relevance of CodeContext when calling IronPython function

Why do you call foo over PythonCall.Call? Try to do it like this: scriptScope.Host.ScriptEngine.Operations.InvokeMember(CLASS-Instance, METHOD-Name, ARGUMENTS); than Ironpython will correctly handle the CodeContext on it's own. You can found a sample implementation here: DlrClass/InvokeMember.

As far as i know, the CodeContext is more than just the scope, just take a look at the definition:

/// <summary>
/// Captures and flows the state of executing code from the generated 
/// Python code into the IronPython runtime.
/// </summary>    
DebuggerDisplay("module: {ModuleName}", Type="module")]
public sealed class CodeContext { // ... }

Hope this helps!

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.