By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,862 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

PyRun_File

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.