Skip to content Skip to sidebar Skip to footer

Multiprocessing Initialising A Function In A Class

I am trying to initialise a function in a class using multiprocessing, by calling it from a function, which is inside the same same class def Streaminit(self,_track): s

Solution 1:

self.streamobj = multiprocessing.Process(target = self.Streaminit(),args=(track,))

You're calling the Streaminit function here with no arguments, and it takes one argument (plus self). So naturally it'll cause an error.

What it looks like you wanted to do was pass the function itself to multiprocessing.Process:

self.streamobj = multiprocessing.Process(target=self.Streaminit, args=(track,))

Post a Comment for "Multiprocessing Initialising A Function In A Class"