Skip to content
Snippets Groups Projects
Commit e33da01a authored by Studer Gabriel's avatar Studer Gabriel
Browse files

port code that we directly feed into the Python interpreter from C++

parent 00ebde86
No related branches found
No related tags found
No related merge requests found
......@@ -185,14 +185,18 @@ int init_python_interpreter()
String python_loc=setup_python_search_path(root, py);
//py.RunCommand("from ost import *");
//py.RunCommand("gui_mode=True");
std::stringstream cmd;
cmd << "execfile('" << python_loc;
std::stringstream script_path;
script_path << python_loc;
#ifdef _MSC_VER
cmd << "\\ost\\gui\\";
script_path << "\\ost\\gui\\";
#else
cmd << "/ost/gui/";
script_path << "/ost/gui/";
#endif
cmd << "gosty_startup.py')";
script_path << "gosty_startup.py";
std::stringstream cmd;
cmd << "exec(compile(open('" << script_path.str() << "').read(),'";
cmd << script_path.str() << "', 'exec'))";
py.RunCommand(QString::fromStdString(cmd.str()));
return 0;
}
......
......@@ -54,7 +54,7 @@ PythonInterpreter::PythonInterpreter():
main_module_ = bp::import("__main__");
main_namespace_ = bp::extract<bp::dict>(main_module_.attr("__dict__"));
main_namespace_["os"]=bp::import("os");
main_namespace_["__builtin__"]=bp::import("__builtin__");
main_namespace_["builtins"]=bp::import("builtins");
main_namespace_["keyword"]=bp::import("keyword");
bp::object code=bp::import("code");
compile_command_=code.attr("compile_command");
......
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