How to run a Python file in c++? -
I am trying to run a python file from C ++, a good part of my day. I have tried:
. . FILE * file = fopen ("file.py", "r"); PyRun_SimpleFile (file, "file.py"); . . .
This only causes crashes of my application. I'm using Python version 3.4.
Try
Py_Initialize (); PyRun_SimpleFile (file, "file.py"); Py_Finalize ();
Comments
Post a Comment