I'm trying to use an embedded python interpreter from C# using pythonnet (the
python3 compatible version found at https://github.com/renshawbay/pythonnet)
My interpreter is located in
D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime and has the "Lib" and
"Libs" folder from the python distribution.
I've tested using the following code:
//====================================================================
PythonEngine.PythonHome =
@"D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime";
PythonEngine.ProgramName = "PythonRuntime";
PythonEngine.Initialize();
using (Py.GIL())
{
PythonEngine.RunSimpleString("print(1)");
}
//====================================================================
But, it doesn't work. I get a "SystemError: PyEvalCodeEx: NULL globals".
Everytime I try to get an object from python, the code fails.
What am I doing wrong?
___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and delete this e-mail. Any unauthorised copying,
disclosure or distribution of the material in this e-mail is prohibited.
Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional
disclosures.
_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet