multiprocessing question/error

E

Eduardo Lenz

Hi,

I was using the former processing package with python 2.5 with no problems.
After switching to python 2.6.1 I am having some problems with the same code.
The problem seems to be related to the fact that I am using Pool.map
with a bounded method, since it is inside a class. To clarify a little bit,
let me show some parts of the code ....

class Pygen3(self)....
....
....
....
def calcula(self,indiv):
....
....
....

def evaluate(self):
....
....
indiv = range(mult*self.popsize,(mult+1)*self.popsize)
pool = Pool(processes=nproc)
results = pool.map(self.calcula,indiv)
...
...

the error is the following

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 522, in __bootstrap_inner
self.run()
File "/usr/lib/python2.6/threading.py", line 477, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.6/multiprocessing/pool.py", line 225, in
_handle_tasks
put(task)
PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup
__builtin__.instancemethod failed


Thanks for your help.

--

Eduardo Lenz Cardoso
Dr. Eng.
Associate Professor

State University of Santa Catarina
Department of Mechanical Engineering
89223-100 - Joinville-SC - Brasil

Tel: +55 47 4009-7971 - Fax: +55 47 4009-7940
E-mail: (e-mail address removed)
---------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top