Sep-15-2022, 10:55 PM
//C++
string path = "C:/PycharmProjects/testProject/test/main.py"
FILE* fp = NULL;
errno_t fp_err = fopen_s(&fp, path.c_str(), "r");
if (fp == NULL)
{
cout << "[PyScript] Error opening file: " << path << endl;
return false;
}
// after calling this, the python main class __init__ will loop forever
int re = PyRun_SimpleFile(fp, path.c_str());
fclose(fp);import ctypes
from multiprocessing import Manager
class TestClass:
def __init__(self, count):
self.count = count
# python will loop here forever, without it the class will run fine
self.sync_manager = Manager() How do I get around this issue on multiprocessing when calling the calss from c++?
