diff --git a/modules/gui/src/gosty.cc b/modules/gui/src/gosty.cc index b5275bb3e694c37359aad5eb2d5140544aae58f8..350b1f520e0322475da27c17104e37bff07936e7 100644 --- a/modules/gui/src/gosty.cc +++ b/modules/gui/src/gosty.cc @@ -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; } diff --git a/modules/gui/src/python_shell/python_interpreter.cc b/modules/gui/src/python_shell/python_interpreter.cc index 29178f2c0a7816459f4838f8b7efe75b447851ea..08b0c34716f9180a0278ec7c31a42dde8e5119b8 100644 --- a/modules/gui/src/python_shell/python_interpreter.cc +++ b/modules/gui/src/python_shell/python_interpreter.cc @@ -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");