samedi 27 juin 2015

self in multiprocessing python

I have searched for how to do this and I don't find it. I suppose someone will put me a link to a google search, but I really don't know what exactly to look for. I'm trying to use Multiprocessing in python with a method of a class. This method has the "self" arg, but even if I pass it I get an error saying that I don't provide it:

Code:

def move_one_particle(self, moving_way):

def move(self, moving_way):
    for dummy_time in range(self.num_particles):
        p=mp.Process(target=self.move_one_particle, args=(moving_way))
        p.start()
        p.join()

output:

move_one_particle() takes exactly 2 arguments (1 given)

Aucun commentaire:

Enregistrer un commentaire