[C++-sig] Embedded python, script has no effect

FoxMulder900 foxmulder900 at yahoo.com
Mon Jul 21 17:20:23 CEST 2008


Hello,
  I have embedded the python interpreter into my program and wrapped my main
classes using boost. In my program i have called Py_Initialize() and when a
key is pressed I am running the following code:

  cout << "attempting to run script" << endl;
  try
  {
      boost::python::object main_module = boost::python::import("pyYEI3D");
      boost::python::exec_file("test.py");
  }
  catch(boost::python::error_already_set const &)
  {
      PyErr_Print();
   }

and here are the contents of 'test.py'

   person = pyYEI3D.getGameObjectByName("person")
   person.translate(100,0,0)

getGameObjectByName is a part of one of my main wrapped class, and it should
return an instance of another one of my wrapped classes - my project is in
OGRE 3D so the translate function should simply translate the returned
object 100 units in 3D space. 

My problem is that nothing is happening at all, no errors are being returned
and the object is not being translated, i know the code is running because
this line is printing correctly:
   cout << "attempting to run script" << endl;

Any suggestions would be much appreciated!
-- 
View this message in context: http://www.nabble.com/Embedded-python%2C-script-has-no-effect-tp18570898p18570898.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.




More information about the Cplusplus-sig mailing list