Thread stops!!

Robert Brewer fumanchu at amor.org
Mon Feb 2 10:47:49 EST 2004


Steve wrote:
> Hi,
> 
> I have a multithreaded python script that collects some data 
> periodically and populates it into a database. For some 
> reason, one of 
> the thread keeps stopping after running for some while and there's no 
> failure or any other sign of failure. What can possibly be 
> going wrong? 
> how can I track this? Is there someway I can find out if ony of the 
> thread stopped? Please help!!
> 
> -- 
> Steve

Quick and dirty: have your threads append exception strings to a
module-level list or dictionary, which you can then read with a
different thread. Example follows; extend if you need it.

runProblems = []

def run_thread():
    try:
        run()
    except Exception, x:
        runProblems.append(str(x))

def dump_problems():
    print runProblems


HTH


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list