multiprocessing question/error

Eduardo Lenz lenz at joinville.udesc.br
Sat Jan 17 00:39:04 EST 2009


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: lenz at Joinville.udesc.br          
 ---------------------------------------------


-- 
Esta mensagem foi verificada pelo sistema de antivírus e
 acredita-se estar livre de perigo.




More information about the Python-list mailing list