Hello everyone.
I have a Python script which is in charge to give me as an output a list of strings after exploiting several Python libraries.
I would like to launch this script inside Juce and store the output inside a variable. I tried to implement my own code by following an old thread (https://forum.juce.com/t/launch-python-script-from-juce/42967).
#include "MainComponent.h"
#ifdef _DEBUG
#define _DEBUG_WAS_DEFINED
#undef _DEBUG
#endif
#include <Python.h>
#ifdef _DEBUG_WAS_DEFINED
#define _DEBUG
#undef _DEBUG_WAS_DEFINED
#endif
MainComponent::MainComponent()
{
pythonFile.getChildFile("hello.py");
FILE* pyFile;
Py_Initialize();
PyRun_SimpleFile(pyFile, pythonFile.getFullPathName().toRawUTF8());
}
However, the code does not work. I’m trying to follow the instructions written here: https://docs.python.org/3/extending/embedding.html, but unfortunately I’m getting nowhere.
Any suggestions?