Multiprocessing bug, is my editor (SciTE) impeding my progress?

Terry Reedy tjreedy at udel.edu
Tue Dec 6 16:42:26 EST 2011


On 12/6/2011 2:13 PM, John Ladasky wrote:

> Exception in thread Thread-1:
> Traceback (most recent call last):
>    File "/usr/lib/python2.6/threading.py", line 532, in
> __bootstrap_inner
>      self.run()
>    File "/usr/lib/python2.6/threading.py", line 484, in run
>      self.__target(*self.__args, **self.__kwargs)
>    File "/usr/lib/python2.6/multiprocessing/pool.py", line 225, in
> _handle_tasks
>      put(task)
> TypeError: expected string or Unicode object, NoneType found
>
> =============================================
>
> Here's what I think would help me debug this error: I would like to
> catch the TypeError, and examine the contents of task.

The traceback says that it is None, which has no contents ;=).

> I need to
> accomplish this WITHOUT adding a try...except block to the Python
> library file multiprocessing/pool.py.

I do not understand this statement. You should feel free to make a 
backup copy of pool.py and then modify it for debugging.

 > I don't know whether this is
> possible, because the traceback isn't clear about where my OWN code
> calls the code which is generating the error.

It appears to be threading trying to call your code, and failing, that 
is the problem. But I do not know how threading, multiprocessing.pool, 
and your code are supposed to interact.

> After that, if the cause of the error still is not obvious, I might
> need to go back to the working program.  Somehow I want to examine the
> contents of task when the program works, and no TypeError is being
> generated.

The traceback says that it is a string.

I would start with the line that fails 'put(task)', and work backwards 
to see where 'task' comes from and how it could become None. It is even 
possible that multiprocessing.pool has a bug that you ran into.

-- 
Terry Jan Reedy




More information about the Python-list mailing list