471,351 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,351 software developers and data experts.

PyRun_File

I cant get result from PyRun_File maybe someone can get me in the right
direction??

Follow code:
PyObject* localDict;
PyObject* mainModule;
PyObject* mainModuleDict;
int i=Py_file_input;

Py_Initialize();

mainModule=PyImport_AddModule("__main__");

if(mainModule==NULL) { }
mainModuleDict=PyModule_GetDict(mainModule);
localDict = PyDict_New();
FILE *fpOut = fopen ("temp.py", "w");

fwrite (tempStr , 1 , hdlsize, fpOut);

fclose(fpOut);

FILE *fpIn = fopen ("temp.py", "r+");

//int tempPyResult = PyRun_SimpleFile (fpIn,
"temp.py");
PyObject* tempPyResult =
PyRun_File(fpIn,"temp.py",i,mainModuleDict,localDi ct);
int lenTempPyResult = PyString_Size(tempPyResult);
char* stempPyResult = PyString_AsString(tempPyResult);
Py_Finalize();

end code

When i try to read tempPyResult i cant get result?

I know that maybe is easy but i can figure out!

Please Help!
--
Thanks Rob
Jul 18 '05 #1
0 1505

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Søren Johansen | last post: by
4 posts views Thread by Preston H | last post: by
reply views Thread by Gi?rgenes | last post: by
reply views Thread by Shane | last post: by
4 posts views Thread by Wesley Henwood | last post: by
3 posts views Thread by marcus.obrien | last post: by
1 post views Thread by moshehaim1 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.