我尝试了所有选项,但无法找到以下代码的问题,当我调用sub self.ProcessXmlFile(xml_file)时它会起作用,但是当我打印result_list时,多处理会抛出以下错误:
cPickle.PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod failed
pool = multiprocessing.Pool(processes=4)
result_list = []
for xml_file in os.listdir(self.local_folder):
result_list.append(pool.apply_async(self.ProcessXmlFile, args = (xml_file,)))
pool.close()
pool.join()