multiprocessing question/error

Discussion in 'Python' started by Eduardo Lenz, Jan 16, 2009.

  1. Eduardo Lenz

    Eduardo Lenz Guest

    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:
    ---------------------------------------------

    --
    Esta mensagem foi verificada pelo sistema de antivĂ­rus e
    acredita-se estar livre de perigo.
     
    Eduardo Lenz, Jan 16, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit N
    Replies:
    4
    Views:
    525
    Paddy
    Sep 13, 2007
  2. Eduardo Lenz

    multiprocessing question/error

    Eduardo Lenz, Jan 17, 2009, in forum: Python
    Replies:
    3
    Views:
    2,032
    Eduardo Lenz
    Jan 17, 2009
  3. xera121
    Replies:
    0
    Views:
    282
    xera121
    Oct 3, 2009
  4. Replies:
    1
    Views:
    586
    Tennessee
    Oct 14, 2009
  5. Junfeng Hu
    Replies:
    12
    Views:
    1,138
    Junfeng Hu
    Nov 19, 2011
Loading...

Share This Page