MCPcopy Create free account
hub / github.com/NatLabRockies/EnergyPlus / getBasicPreamble

Method getBasicPreamble

src/EnergyPlus/PythonEngine.cc:377–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375 }
376
377 std::string PythonEngine::getBasicPreamble()
378 {
379 std::string cmd = R"python(import sys
380sys.argv.clear()
381sys.argv.append("energyplus")
382)python";
383 fs::path programDir = FileSystem::getParentDirectoryPath(FileSystem::getAbsolutePath(FileSystem::getProgramPath()));
384 fs::path const pathToPythonPackages = programDir / "python_lib";
385 std::string sPathToPythonPackages = std::string(pathToPythonPackages.string());
386 std::replace(sPathToPythonPackages.begin(), sPathToPythonPackages.end(), '\\', '/');
387 cmd += EnergyPlus::format("sys.path.insert(0, \"{}\")\n", sPathToPythonPackages);
388 return cmd;
389 }
390
391 std::string PythonEngine::getTclPreppedPreamble(std::vector<std::string> const &python_fwd_args)
392 {

Callers

nothing calls this directly

Calls 4

getParentDirectoryPathFunction · 0.85
getAbsolutePathFunction · 0.85
getProgramPathFunction · 0.85
formatFunction · 0.85

Tested by

no test coverage detected