Python code using DataLoader not running from C++

Hi

When I run the transferTrainingNoImages.py code from Python it runs with no problems.

But when I try running it from C++ like below
then it goes into an infinite loop. I tried debugging the python code and it seems there is some problem in line 63 in the python file.

#define PY_SSIZE_T_CLEAN
#include <python.h>

using namespace std;

int main()
{
char filename[ ] = “transferTrainingNoImages.py”;

FILE* fp;

Py_Initialize();

auto err = fopen_s(&fp, filename, "r");

PyRun_SimpleFile(fp, filename);

Py_Finalize();

}

Can anyone point me to the problem.

Thanks

I have the problem. can’t run python codes with DataLoader from c++. any solution?