MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / setupPythonPath

Method setupPythonPath

python/engine/PythonEngine.cpp:75–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void PythonEngine::setupPythonPath(const std::vector<openstudio::path>& includeDirs) {
76
77 // Iterate in reverse order since addToPythonPath always inserts at pos 0
78 // --python_path path1 --python_path path2 => includeDirs = ["path1", "path2"]
79 // std::ranges::reverse_view needs modern compilers
80 for (auto it = includeDirs.rbegin(); it != includeDirs.rend(); it++) {
81 addToPythonPath(*it);
82 }
83}
84
85PythonEngine::PythonEngine(int argc, char* argv[]) : ScriptEngine(argc, argv), program(Py_DecodeLocale(pythonProgramName, nullptr)) {
86 // TODO: modernize and use PyConfig (new in 3.8): https://docs.python.org/3/c-api/init_config.html

Callers 1

mainFunction · 0.80

Calls 1

addToPythonPathFunction · 0.85

Tested by

no test coverage detected