我正在使用
Zope - 2.13.19
Python - 2.6.8
以下代码在手动运行时有效,但在外部方法中无效。 它引发以下错误。我在概念上做错了吗?
Exception in thread Thread-3:
Traceback (most recent call last):
File "/opt/python2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/opt/python2.6/lib/python2.6/threading.py", line 484, in run
self.__target(*self.__args, **self.__kwargs)
File "/opt/python2.6/lib/python2.6/multiprocessing/pool.py", line 225, in _handle_tasks
put(task)
TypeError: expected string or Unicode object, NoneType found
import time
from multiprocessing import Pool
import logging
def func(name):
print 'hello %s,' % name
time.sleep(5)
print 'nice to meet you.'
def get_data():
pool = Pool(processes=2)
pool.map(func, ('frank', 'justin', 'osi', 'thomas'))
答案 0 :(得分:0)