Hi
I am new to python programming and I am trying to embed some python calls into my C++ program. I made a simple module called 'test.py' which has the following lines :
//---------test.py------------------
message = 'The meaning of life...'
def transform (input):
input = input.replace ('life', 'Python..');
return input.upper()
//--------------------------------------
In c++,
{
Py_Initialize ();
PyRun_SimpleString ("import test");
PyRun_SimpleString ("print test.transform ('life')");
}
//------------------------------------------
When I run this program, I get an error :
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named test
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'test' is not defined
Can someone help me out with this? The code works if I go into IDLE and type >>> import test.
What am I doing wrong?
Thanks
**** If it is important, I downloaded and installed python 2.5.2 and I am using it on openSuse 10.2