Threaded alternatives to smtplib?

Alex Jurkiewicz alex at
Mon May 4 10:31:46 CEST 2009

Gabriel Genellina wrote:
> Try logging the start/stop of your threads. It may be that your 
> threads stop before you think. The above code works correctly only if 
> you fill the queue before starting any thread - because as soon as a 
> thread sees the queue empty, it finishes.
> You could use the sample code in the Queue documentation at the end of 
The queue is actually filled before the threads are started, data is 
only removed after they start.

Logging thread state (at least in debug mode) would be good though. How 
would I go about it in this example? The docs suggest using, 
but in my current setup I don't have any idea which thread is running. 
Something like this:
for i in range(CONCURRENCY):
    THREADS.append( threading.Thread(target=threadProcessRecipient, 
args=i, name=i) )


def threadProcessRecipient(name):
    print "Name is %s" % name


More information about the Python-list mailing list