diff --git a/modules/gui/src/python_shell/python_interpreter_worker.cc b/modules/gui/src/python_shell/python_interpreter_worker.cc
index 272f018a43aa53a18a729e5f7592dded20fdc5cc..1a0d3bab80591b990fac310b9c1b97c2da466cd1 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.cc
+++ b/modules/gui/src/python_shell/python_interpreter_worker.cc
@@ -21,6 +21,7 @@
 #include "python_interpreter_worker.hh"
 #include "python_interpreter.hh"
 
+
 namespace ost { namespace gui {
 
     namespace {
@@ -55,7 +56,7 @@ PythonInterpreterWorker::PythonInterpreterWorker():
   current_id_(),
   awake_(false)
 {
-  parse_expr_cmd_=bp::import("parser").attr("expr");
+  parse_expr_cmd_=bp::import("__main__").attr("__builtins__").attr("compile");
   main_namespace_ = bp::extract<bp::dict>(bp::import("__main__").attr("__dict__"));
   repr_=bp::import("__main__").attr("__builtins__").attr("repr");
   #ifndef _MSC_VER
@@ -98,16 +99,6 @@ unsigned int PythonInterpreterWorker::AddCommand(const QString& command)
   return command_id_;
 }
 
-bool PythonInterpreterWorker::is_simple_expression_(const QString& expr)
-{
-  try {
-    parse_expr_cmd_(bp::str(expr.toStdString()));
-    return true;
-  } catch(bp::error_already_set&) {
-    PyErr_Clear();
-    return false;
-  }
-}
 void PythonInterpreterWorker::run_command_(std::pair<unsigned int,QString> pair)
 {
   #ifndef _MSC_VER
@@ -148,7 +139,7 @@ void PythonInterpreterWorker::run_command_(std::pair<unsigned int,QString> pair)
 bool PythonInterpreterWorker::is_simple_expression(const QString& expr)
 {
   try {
-    parse_expr_cmd_(bp::str(expr.toStdString()));
+    parse_expr_cmd_(bp::str(expr.toStdString()), "<string>", "eval");
     return true;
   } catch(bp::error_already_set&) {
     PyErr_Clear();
diff --git a/modules/gui/src/python_shell/python_interpreter_worker.hh b/modules/gui/src/python_shell/python_interpreter_worker.hh
index c8dc4ba3f9f8ef9bce55abb8e3f2adddd8916125..0fcb456143f5339c02f0e46e0addbdbea8fd27b4 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.hh
+++ b/modules/gui/src/python_shell/python_interpreter_worker.hh
@@ -62,7 +62,6 @@ protected slots:
 protected:
   bool is_simple_expression(const QString& expr);
   void run_command_(std::pair<unsigned int,QString> pair);
-  bool is_simple_expression_(const QString& expr);
   QQueue<std::pair<unsigned int,QString> > exec_queue_;
   unsigned int command_id_;
   boost::shared_ptr<OutputRedirector>  output_redirector_;