Python Forum
PyRun_SimpleFile calling multiprocessing Python Class cause endless init loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyRun_SimpleFile calling multiprocessing Python Class cause endless init loop
#1
//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++?
Reply


Messages In This Thread
PyRun_SimpleFile calling multiprocessing Python Class cause endless init loop - by Xeno - Sep-15-2022, 10:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python script is hanging while calling a procedure in database prasanthi417 4 648 Jan-17-2024, 02:33 PM
Last Post: deanhystad
  Is this a multiprocessing bug in Python - or am I doing something wrong? haimat 1 1,279 Oct-18-2023, 06:07 AM
Last Post: absalom1
  python multiprocessing help -- to extract 10 sql table into csv mg24 3 1,477 Nov-20-2022, 11:50 PM
Last Post: mg24
  python multiprocessing to download sql table mg24 5 1,582 Oct-31-2022, 03:53 PM
Last Post: Larz60+
  Python multiprocessing Pool apply async wait for process to complete sunny9495 6 6,701 Apr-02-2022, 06:31 AM
Last Post: sunny9495
  Init an indefinite number of class MathisDELAGE 9 2,450 Feb-18-2022, 07:49 PM
Last Post: deanhystad
  Calling a base class variable from an inherited class CompleteNewb 3 1,788 Jan-20-2022, 04:50 AM
Last Post: CompleteNewb
  Calling a class from a function jc4d 5 1,939 Dec-17-2021, 09:04 PM
Last Post: ndc85430
  Calling functions from within a class: PYQT6 Anon_Brown 4 3,910 Dec-09-2021, 12:40 PM
Last Post: deanhystad
  Class variables and Multiprocessing(or concurrent.futures.ProcessPoolExecutor) Tomli 5 4,017 Nov-12-2021, 09:55 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020