<p>在命令输出中进一步检查。
至少在Python 3.4中,<code>multiprocessing.pool</code>将有助于在父进程回溯上方打印一个<code>RemoteTraceback</code>。你会看到这样的东西:</p>
<pre><code>multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.4/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.4/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/path/to/your/code/here.py", line 80, in sort_file
something = row[index]
IndexError: list index out of range
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "generic.pyx", line 17, in generic.sort_files (/users/cyounker/.pyxbld/temp.linux-x86_64-2.7/pyrex/generic.c:1723)
sorted_dicts = pool.map(sort_file, csv_files, 1)
File "/usr/lib64/python2.7/multiprocessing/pool.py", line 227, in map
return self.map_async(func, iterable, chunksize).get()
File "/usr/lib64/python2.7/multiprocessing/pool.py", line 528, in get
raise self._value
IndexError: list index out of range
</code></pre>
<p>在上述情况下,引发错误的代码位于<code>/path/to/your/code/here.py", line 80</code></p>
<p>另见<a href="https://stackoverflow.com/questions/29080650/debugging-errors-in-python-multiprocessing">debugging errors in python multiprocessing</a></p>