Read Application python logs

neel patel neel5481 at gmail.com
Fri Jul 14 03:52:53 EDT 2017


Hi,

I wrote one simple C code and integrated python interpreter.

I am using Python C API to run the python command.

Below code used Python C API inside .c file.


PyObject* PyFileObject = PyFile_FromString("test.py", (char *)"r");

int ret = PyRun_SimpleFile(PyFile_AsFile(PyFileObject), "test.py");

if (ret != 0)

    print("Error\n");


Above code working fine. It runs the "test.py" but inside "test.py" there
is some print statement so how can i read those messages in this .c file
from console ?

Thanks in Advance.



More information about the Python-list mailing list