嗨,我一直在为这个早上的大部分时间而苦苦挣扎,希望有人能指出我正确的方向.
这是我目前的代码:
def f(tup): return some_complex_function(*tup) def main(): pool = Pool(processes=4) #import and process data omitted _args = [(x.some_func1,.05,x.some_func2) for x in list_of_some_class] results = pool.map(f,_args) print results
我得到的第一个错误是:
> Exception in thread Thread-2: Traceback (most recent call last): > File "/usr/lib/python2.7/threading.py",line 551,in __bootstrap_inner > self.run() File "/usr/lib/python2.7/threading.py",line 504,in run > self.__target(*self.__args,**self.__kwargs) File "/usr/lib/python2.7/multiprocessing/pool.py",line 319,in > _handle_tasks > put(task) PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod Failed
任何帮助将非常感激.