IronPython sys._getframe not found

前端 未结 2 1689
孤街浪徒
孤街浪徒 2021-01-04 08:32

I\'m currently building a program in C# which will call functions in provided python script files.
Some of these script files calls _getframe() in sys

相关标签:
2条回答
  • 2021-01-04 09:03

    A little out of the scope of the question, but meant for anyone else getting this error by invoking a Python script using the ipy.exe interpreter directly.

    You can just add the argument -X:FullFrames. So for example invoke the script like

    ipy.exe -X:FullFrames script.py
    
    0 讨论(0)
  • 2021-01-04 09:09

    When creating the PythonEngine you can pass a dictionary of options; you just need to set the "Frames" and/or "FullFrames" keys in the dictionary to true:

    var options = new Dictionary<string, object>();
    options["Frames"] = true;
    options["FullFrames"] = true;
    ScriptEngine engine = Python.CreateEngine(options);
    

    If you don't want FullFrames, just leave it out or set it to false.

    0 讨论(0)
提交回复
热议问题