Tuesday, July 01, 2008

How to call python module from Symbian C++

You can execute python code from Symbian C++ application ! Here's an simple example :

CSPyInterpreter* it = CSPyInterpreter::NewInterpreterL();
CleanupStack::PushL(it);
PyEval_RestoreThread(PYTHON_TLS->thread_state);

PyRun_SimpleString("open(r'c:\\foo.txt', 'w').write('hello')\n");

PyEval_SaveThread();
CleanupStack::PopAndDestroy(it);

No comments:

stats counter