Skip to content
Snippets Groups Projects
Commit ad03e951 authored by AlQuemist's avatar AlQuemist
Browse files

PyInterpreter: fx BornAgain::addPythonPath

parent 06ca2323
No related branches found
No related tags found
1 merge request!2755Improve the construction of a 'Sample' from a Python script
...@@ -129,9 +129,10 @@ bool PyInterpreter::checkError() ...@@ -129,9 +129,10 @@ bool PyInterpreter::checkError()
// Python stable ABI // Python stable ABI
void PyInterpreter::addPythonPath(const std::string& path) void PyInterpreter::addPythonPath(const std::string& path)
{ {
ASSERT(!path.empty()); if (!path.empty()) {
PyObject* sysPath = PySys_GetObject("path"); PyObject* sysPath = PySys_GetObject("path");
PyList_Append(sysPath, PyUnicode_FromString(path.c_str())); // add to `PYTHONPATH` PyList_Append(sysPath, PyUnicode_FromString(path.c_str())); // add to `PYTHONPATH`
}
} }
// Python stable ABI // Python stable ABI
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment