summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Touceda <chiiph@leap.se>2013-06-20 16:46:13 -0300
committerTomas Touceda <chiiph@leap.se>2013-06-20 16:46:13 -0300
commitcfb1c3e9686f1a4ca5a5444f6b4396e9253b400f (patch)
tree4f1753879d9f248b987ad30dfb5885da61396efb
parent709ea693f1b0b6106c9d26d1f71a607c5f64a531 (diff)
Improve "bundlelization" by setting PYTHONPATH and PYTHONHOME properly
-rw-r--r--src/main.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 2c0954b..ee5725a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,6 +2,7 @@
#include <vector>
#include <string>
#include <cmath>
+#include <cstdlib>
#include <boost/python.hpp>
#include <boost/filesystem/operations.hpp>
@@ -117,10 +118,11 @@ main(int argc, char** argv)
fs::path full_path(fs::current_path());
updateIfNeeded();
-
- Py_Initialize();
+ auto pypath = full_path.string() + ":" + full_path.string() + "/lib/";
+ setenv("PYTHONPATH", pypath.c_str(), 1);
Py_SetPythonHome(const_cast<char*>(full_path.string().c_str()));
+ Py_Initialize();
py::object main_module = py::import("__main__");
py::object global = (main_module.attr("__dict__"));