# coding: utf-8
import multiprocessing
class A(object):
def __init__(self):
pass
def run(self):
sheets = ['a', 'b', 'c', 'd', 'e']
result = []
pool = multiprocessing.Pool(processes=5)
for index, sheet in enumerate(sheets):
result.append(pool.apply_async(self.test, (sheet)))
pool.close()
pool.join()
for data in result:
print data.get()
def test(self, args):
return args
if __name__ == '__main__':
A().run()
I try to run the code above and get an error, hoping to get your answer: cPickle.PicklingError: Can't pickle : attribute lookup builtin.instancemethod failed