19 lines
428 B
C++
19 lines
428 B
C++
char RunPy(const char *py, bool _testPy = false ){
|
|
char result = {};
|
|
const char* _TestPyCode =
|
|
"print('PYTHON APPEARS TO BE WORKING!!!')";
|
|
|
|
Py_Initialize();
|
|
|
|
if(_testPy){
|
|
result = PyRun_SimpleString(_TestPyCode);
|
|
return result;
|
|
}
|
|
|
|
result = PyRun_SimpleString(py);
|
|
if (result != 0) std::cerr << "Python execution failed." << std::endl;
|
|
|
|
Py_Finalize();
|
|
return result;
|
|
}
|